5 if [ -z "$1" -o -z "$2" -o -z "$3" ]; then
6 echo "Syntax: ./edit-user-email.sh <username> <old e-mail> <new e-mail>"
10 COUNT
=`grep -E -c "^$1:" $ETC/passwd`
11 if [ "$COUNT" -ne "1" ]; then
12 echo "fatal: user '$1' doesn't appear to exist (or exists multiple times, or contains regexpy characters)."
15 sed -i "s/^$1\(:[^:]*:[^:]*:[^:]*:\)$2:/$1\\1$3:/; t show; b; : show; w /dev/stderr" $ETC/passwd
16 echo "All changed lines listed above."