##deleate
rm -f /root/user_password.txt /root/user_names.txt /root/user_list.txt
##create stu01-stu10
echo stu{01..10}|xargs -n1 >> /root/user_names.txt
##create users stu01-stu10 and build password
cat /root/user_names.txt|sed 's#.*#useradd &;echo $RANDOM |md5sum|cut -c 1-8 >>/root/user_password.txt;tail -1 /root/user_password.txt |passwd --stdin &#g'|bash
###log name and password
cat /root/user_names.txt |xargs -n10 >/root/user_list.txt && cat /root/user_password.txt |xargs -n10 >>/root/user_list.txt
###show the list
cat /root/user_list.txt
转载于:https://blog.51cto.com/11361008/1914692