#!/bin/bash
read -p "请输入用户名:" name
if [ -z $name ]; then
echo "必须输入用户名"
exit
fi
read -p "请输入密码:(默认密码为123)" pass
pass=${pass:-123}
useradd "$name"
echo "$pass" | passwd --stdin "$name"
userdel "$name"
read -p "请输入用户名:" name
if [ -z $name ]; then
echo "必须输入用户名"
exit
fi
read -p "请输入密码:(默认密码为123)" pass
pass=${pass:-123}
useradd "$name"
echo "$pass" | passwd --stdin "$name"
userdel "$name"
本文转自 英强云计算 51CTO博客,原文链接:http://blog.51cto.com/13404755/2050764,如需转载请自行联系原作者