㈠ linux redhat shell 脚本 批量添加用户
#!/bin/sh
i=0
while true
do
let i=i+1
echo "u"$i":123456" >>/root/user.txt
echo "createing user u$i ................."
useradd u$i
if [ $i -eq 100 ]
then
/usr/sbin/chpasswd /root/user.txt
/bin/rm -f /root/user.txt
exit
fi
done
#if you want to delete all of the user,you can
#i=0
#while true
#do
# let i=i+1
# echo "deleteing user u$i ................."
# userdel -r u$i
# if [ $i -eq 100 ]
# then
# exit
# fi
#done
供参考