我的unix代码有问题
#!/bin/bash
while : ; do
echo "SELECT OPTION"
echo "-------------"
echo "1- Create username"
echo "2- Create password"
echo "3- Delete username"
echo "4- Exit"
read -p "enter option 1 2 3 or 4:" option
case option in
1) read -p "Enter username:"
adduser $REPLY && echo "Username successfully entered" ;;
2) passwd && "Password successfully entered" ;;
3) read -p "Enter user to be deleted: "
deluser $REPLY && echo "User deleted" ;;
4) exit ;;
*) continue ;;
esac
done
确定选择选项有效,但如果我输入1或2作为创建用户名或密码的选项,它会再次将我带回选择选项。无论我做什么,它都会显示选择选项
有人可以帮助我使用bash在unix中运行此代码。
谢谢
答案 0 :(得分:4)
尝试$option
- option
被解释为字符串。