mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-04-24 11:41:15 -03:00
use getent for passwd and group if available
This commit is contained in:
@@ -1,4 +1,8 @@
|
||||
|
||||
function __fish_complete_groups --description "Print a list of local groups, with group members as the description"
|
||||
cat /etc/group | sed -e "s/^\([^:]*\):[^:]*:[^:]*:\(.*\)/\1\tMembers: \2/"
|
||||
if test -x /usr/bin/getent
|
||||
getent group | cut -d ':' -f 1,4 | sed 's/:/\t/'
|
||||
else
|
||||
cut -d ':' -f 1,4 /etc/group | sed 's/:/\t/'
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user