From e7de1eb66b19f3bb79d5bf929f4c8b661644bfdb Mon Sep 17 00:00:00 2001 From: Nicolas Boisselier Date: Wed, 21 Sep 2016 12:00:56 +0100 Subject: [PATCH] ls_users --- etc/profile.d/functions | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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 } -- 2.47.3