**`
用shell脚本写创建用户并设置密码
`**
time=1
while [ $time -le 5 ]
do
echo "please input NO$time users info:"
read -p "enter user:" USER
id $USER &> /dev/null
if [ $? -eq 0 ];then //判断上行操作返回值是否等于0
echo "user $USER yi cun zai "
else
read -p "enter password:" PASSWD
useradd $USER &> /dev/null
echo "$PASSWD" | passwd --stdin $USER &> /dev/null
let time++
if [ $? -eq 0 ]; then
echo "user $USER ,chuang jian cheng gong."
else
echo "$USER,chuang jian shi bai! "
fi
fi
done