shell初級プログラミング
機能:入力したユーザー名が/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