mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-05-02 19:21:15 -03:00
use getent for passwd and group if available
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user