批量添加删除用户脚本(2)
来源:未知 责任编辑:责任编辑 发表时间:2013-12-18 11:35 点击:次
done
fi
;;
2)
echo "***************************DEL USER********************************"
echo -n "Are you ensure to del user?[y|Y/n|N]"
read yes
if [ "$yes" == "y" -o "$yes" == "Y" ]
then
while [ "$i" != "$2" ]
do
echo "*********************DEL USER $curaccount *********************"
ifexist=`cat /etc/passwd | awk -F : "{print \\$1}" | grep $curaccount`
if [ "$ifexist" == "$curaccount" ]
then
userdel -r $curaccount
echo "******THE USER $curaccount HAS BEEN DELETED ! OK********"
else
echo "************The USER $curaccount DOES NOT EXISTS!***********"
echo "***********************NEXT!*******************************"
fi
i=$(($i+1))
curaccount=$(($curaccount+1))
done
fi
;;
*)
echo "******************************NOTICE*****************************"
echo "please see the notice clear"
error
;;
esac
echo "***********************THE OPERATOR HAS BEEN FINISHED!************************"
本文出自 “lopnxrp” 博客
相关新闻>>
- 发表评论
-
- 最新评论 更多>>