diff options
author | David Adam (zanchey) <zanchey@ucc.gu.uwa.edu.au> | 2012-11-22 17:07:19 +0800 |
---|---|---|
committer | David Adam (zanchey) <zanchey@ucc.gu.uwa.edu.au> | 2012-11-27 11:49:52 +0800 |
commit | 8253df7c3d99d47f6822fec0e0ef68c4f6b35796 (patch) | |
tree | f1e2243ab3faaeed87ce650973d177a58f2adbff /share/functions/__fish_complete_users.fish | |
parent | 4788da204ba3a1fade4b4dfcb29e8fb7f80e9085 (diff) |
use getent for passwd and group if available
Diffstat (limited to 'share/functions/__fish_complete_users.fish')
-rw-r--r-- | share/functions/__fish_complete_users.fish | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/share/functions/__fish_complete_users.fish b/share/functions/__fish_complete_users.fish index e3ca35f4..82fa8577 100644 --- a/share/functions/__fish_complete_users.fish +++ b/share/functions/__fish_complete_users.fish @@ -1,4 +1,8 @@ function __fish_complete_users --description "Print a list of local users, with the real user name as a description" - cat /etc/passwd | grep -ve '^#' | sed -e 's/^\([^:]*\):[^:]*:[^:]*:[^:]*:\([^:]*\):.*$/\1'\t'\2/' ^/dev/null + if test -x /usr/bin/getent + getent passwd | cut -d : -f 1,5 | sed 's/:/\t/' + else + sgrep -ve '^#' /etc/passwd | cut -d : -f 1,5 | sed 's/:/\t/' + end end |