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