1)使用脚本实现添加20个账户,并且账户密码与账户名相同
   #!/bin/bash
   for I in {1..20};do
   if ! cut -d: -f1 /etc/passwd | grep "^user${I}$" &> /dev/null;then
   useradd user$I
   echo "user$I" |passwd --stdin user$I
   fi
   done
    

2)使用脚本实现删除用户,考虑删除的用户数目少于已经有的用户数目
    #!/bin/bash
   for I in {1..30};do
   if cut -d: -f1 /etc/passwd | grep "^user${I}$" &> /dev/null;then
   userdel -r user$I &> /dev/null
   [ $? -eq 0 ]  &&  echo "user$I is deleted."
   fi
   done