#!/usr/bin/bash
read -p "Please input a username:" user
id $user &>/dev/null
if [ $? -ne 0 ];then
echo "no such user: $user"
exit 1
fi
read -p "Are you sure?[y/n]" action
#if [ $action == 'y' ];then
# userdel -r $user
# echo "$user is del..."
#
#fi
case "$action" in
y|Y|yes|yes)
userdel -r $user
echo "$user is deleted"
;;
*)
echo "error"
esac
作者简介:
陈志珂(头条号:强扭的瓜不好吃)目前就职于中国最大的安卓应用软件公司,任高级工程师,现在公司任php开发工程师,python开发工程师,高级运维工程师,公众号“铅笔学园”运维内容合作作者之一。
铅笔学园:IT资源分享|知识分享,做初级程序员的指明灯