批量添加删除用户(SHELL)
2009-11-25 16:20
766 查看
###############################################
#!/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
###############################################
#!/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
###############################################
相关文章推荐
- 批量添加删除用户(SHELL)
- shell脚本-批量添加或删除用户
- shell批量添加删除100用户
- shell 批量添加用户、删除用户
- centos100用户批量添加及删除shell
- SHELL 脚本批量添加删除用户
- 批量添加删除用户方法三
- 【shell脚本练习】批量添加用户和设置密码
- 批量添加或删除用户
- shell批量添加和删除前缀
- AngularJS综合用户信息, 表单验证,过滤查询,全选反选,批量删除,修改,添加
- 写了一个Linux下批量添加用户的shell脚本
- sell脚本应用:批量添加(删除)用户
- shell 编程 批量添加用户
- shell应用:批量添加用户
- 脚本批量添加和批量删除用户
- 用户的批量添加与删除——方法一
- shell for循环笔记 批量添加用户
- linux批量添加、删除用户
- 批量添加删除用户脚本