summaryrefslogtreecommitdiffstats
path: root/Completion/compaudit
diff options
context:
space:
mode:
authorOliver Kiddle <opk@users.sourceforge.net>2004-03-30 16:38:04 +0000
committerOliver Kiddle <opk@users.sourceforge.net>2004-03-30 16:38:04 +0000
commit3876601c794b57342d14152bef1884f2a4213621 (patch)
tree468be5827ebe2c43cd5558d86c0452e20531195c /Completion/compaudit
parent19707: negative index into arrays should return scalar and not one element array (diff)
downloadzsh-3876601c794b57342d14152bef1884f2a4213621.tar
zsh-3876601c794b57342d14152bef1884f2a4213621.tar.gz
zsh-3876601c794b57342d14152bef1884f2a4213621.tar.bz2
zsh-3876601c794b57342d14152bef1884f2a4213621.tar.lz
zsh-3876601c794b57342d14152bef1884f2a4213621.tar.xz
zsh-3876601c794b57342d14152bef1884f2a4213621.tar.zst
zsh-3876601c794b57342d14152bef1884f2a4213621.zip
19708: change getent() to handle two arguments
Diffstat (limited to 'Completion/compaudit')
-rw-r--r--Completion/compaudit8
1 files changed, 7 insertions, 1 deletions
diff --git a/Completion/compaudit b/Completion/compaudit
index c4dbb6e11..25ba21c94 100644
--- a/Completion/compaudit
+++ b/Completion/compaudit
@@ -15,7 +15,13 @@ compaudit() { # Define and then call
emulate -L zsh
setopt extendedglob
-[[ -x /usr/bin/getent ]] || getent() { cat /etc/$1 }
+[[ -x /usr/bin/getent ]] || getent() {
+ if [[ $2 = <-> ]]; then
+ grep ":$2:[^:]*$" /etc/$1
+ else
+ grep "^$2:" /etc/$1
+ fi
+}
# The positional parameters are the directories to check, else fpath.
if (( $# )); then