我有一個腳本,由於某種原因,它似乎跳過了一步。Linux腳本無法正常工作
[2]) echo "Delete a User"
read -p "What is the user that you would wish to delete?" username
egrep "^$username" /etc/passwd > /dev/null
if [ $? -eq 0 ]; then
read -p "Do you want to delete their home directory also? 1(yes)/2(no)" home
else
echo "That user does not exist"
sleep 3
if [ $home -eq 1 ]; then
userdel -r $username
else
userdel $username
if [ $? -eq 0 ]; then
echo "$username deleted."
sleep 3
else
echo "$username was not deleted."
sleep 3
fi fi fi
;;
它的工作起來,我問,如果用戶希望他們的主目錄刪除或不。如果我打yes或no,它只是跳過並轉到腳本的菜單..