if [ -z "$1" ]; then echo usage: $0 PATTERN ; exit 1; fi cat /etc/passwd | cut -d: -f1 | grep $1 | while read u; do userdel -r $u; done