批量添加删除用户(SHELL)
时间:2009-03-23 来源:sjhf
####################################################################### #!/bin/bash #the script act on a batch of add user,username at the same password #If you have any suggestions for corrections,please leave me a comment, and I’ll check it out. read -p "please input username and number(for example:xuanfei 100):" a b for((i=1;i<=$b+1;i++)) do useradd -m $a$i echo "$a$i:$a$i" |chpasswd pwconv && echo "add succeed :$a$i" done ####################################################################### #!/bin/bash #the script act on delete user for the same The same features (for example:xuanfei1 xuanfei2 xuanfei3) #If you have any suggestions for corrections,please leave me a comment, and I’ll check it out. read -p "please input the username location (for example:xuanfei 1 100):" a b c let d=$c-$b+1 for((i=1;i<=$d;i++)) do userdel $a$b && echo "delete succeed:$a$b" rm -rf /home/$a$b let b=b+1 done ####################################################################### |
相关阅读 更多 +