From 1168e12a96d77c83be8a0a8b5e11c7e8e0a401ef Mon Sep 17 00:00:00 2001 From: Jonas Smedegaard Date: Sat, 8 Oct 2011 10:17:22 +0200 Subject: Use getent (not grep shadow file). --- localnotifypwexp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/localnotifypwexp b/localnotifypwexp index e6e2ef6..29811a7 100755 --- a/localnotifypwexp +++ b/localnotifypwexp @@ -30,9 +30,7 @@ declare -r aged=21 # minimum days after expiration before admins are emailed, se hostname=$(hostname --fqdn) domainname=$(hostname --domain) -# /etc/shadow is system dependent -shadowfile="/etc/shadow" -# fields in /etc/shadow +# fields in shadow file (system dependent) declare -r last=2 #declare -r may=3 # not used in this script declare -r must=4 @@ -50,10 +48,8 @@ declare -r unamefield=1 declare -r uidmin=1000 declare -r uidmax=65534 # exclusive -# remove the hardcoded path from these progs to use them via $PATH # mailx is system dependent notifyprog="mailx" -grepprog="grep" awkprog="awk" dateprog="date" @@ -109,7 +105,7 @@ for user in $users; do IFS=":" - usershadow=$($grepprog ^$user $shadowfile) + usershadow=$(getent shadow $user) # make an array out of it usershadow=($usershadow) -- cgit v1.2.3