#!/bin/bash
clear
read -p "请输入创建用户的名称前缀:" qz
read -p "请输入创建用户的个数:" num
read -p "请输入用户的初始密码:" ps
read -p "请输入用户的失效时间(YYYY-MM-DD):" ext
i=1
while [ $i -le $num ]
do
if [ ! -z $ext ]
then
useradd -e $ext $qz$i
else
useradd $qz$i
fi
echo "$ps" |passwd --stdin $qz$i &> /dev/null
chage -d 0 $qz$i
let i++
done
=========================================================
#!/bin/bash
for i in user{1..20}
do
userdel -r $i
done