From: Nicolas Boisselier Date: Wed, 21 Sep 2016 11:00:56 +0000 (+0100) Subject: ls_users X-Git-Url: https://git.nbdom.net/?a=commitdiff_plain;h=e7de1eb66b19f3bb79d5bf929f4c8b661644bfdb;p=nb.git ls_users --- diff --git a/etc/profile.d/functions b/etc/profile.d/functions index 1b18f889..fe4a4337 100644 --- a/etc/profile.d/functions +++ b/etc/profile.d/functions @@ -597,7 +597,14 @@ function ls_users() { ; ;; *) - grep '^[^#:]\+:' /etc/passwd | sort -u | sort -t : -k3,4 -n + if [ -n "$(which zgetent 2>/dev/null)" ]; then + getent passwd + elif [ -e /etc/passwd ]; then + grep '^[^#:]\+:' /etc/passwd | sort -u | sort -t : -k3,4 -n + else + echo "$FUNCNAME: can not find any users on this system: #OSTYPE" 1>&2 + return 1 + fi ;; esac }