标签:创建用户
#!/bin/bashread -p "Please input username: " name
id $name &> /dev/null
if [ $? -ne 0 ];then
useradd $name && echo "$name create success."
read -sp "Please input password: " pw
echo
if [ ${#pw} -ge 7 ];then
read -sp "Please again input password: " pw2
echo
if [ $pw = $pw2 ];then
echo $pw |passwd --stdin $name &> /dev/null
echo "Password create success."
else
echo "Inconsistency of password input."
fi
else
echo "Password input error."
fi
else
echo "$name already exist."
fi
思路:
标签:创建用户
原文地址:http://blog.51cto.com/13765357/2121426