标签:not name source function md5sum creat 字符串 ldb etc
#!/bin/sh$P
for Name in oldboy{01..10}
do
CheckUser=$(grep -w "$Name" /etc/passwd|wc -l)
if [ $CheckUser -eq 1 ];then
action "$Name already exist!" /bin/false
continue
fi
useradd $Name &&\
PASS=$(echo $RANDOM|md5sum|cut -c 1-8)
echo -e "$Name:$PASS"|tee -a $P|chpasswd
R=$?
if [ $R -eq 0 ];then
action "Useradd $Name is successful!" /bin/true
fi
done
批量创建10个系统帐号oldboy01-oldboy10并设置密码(密码为随机8位字符串)。
标签:not name source function md5sum creat 字符串 ldb etc
原文地址:http://blog.51cto.com/9447803/2161414