功能:判断输入的用户名是否存在与/etc/passwd中
#!/bin/bash if [ $# -le 0 ];then echo "Please input the right arg" else i=`cat /etc/passwd | cut -f1 -d':' | grep -w "$1" -c ` if [ $i -le 0 ];then echo "User $1 is not in the passwd" else echo "User $1 is in the passwd" fi fi