From 6824215e67b08b53b83ca7238a6e0c2d5fe32c62 Mon Sep 17 00:00:00 2001 From: Bryan Roessler Date: Sun, 23 Jan 2022 12:12:55 -0500 Subject: [PATCH] Fix edge case script-user-reset-password --- script-user-reset-password | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/script-user-reset-password b/script-user-reset-password index 7feeb41b..33fd02ac 100755 --- a/script-user-reset-password +++ b/script-user-reset-password @@ -11,7 +11,11 @@ parent=${parent%/*} is_root -[[ $# -lt 1 ]] && echo "Must provide a username" && exit 1 +if [[ $# -lt 1 ]]; then + echo "Current users: " + eval "getent passwd {$(awk '/^UID_MIN/ {print $2}' /etc/login.defs)..$(awk '/^UID_MAX/ {print $2}' /etc/login.defs)} | cut -d: -f1" + exit 1 +fi [[ $# -ge 1 ]] && user="$1"