判断用户输入的是 Yes 或 NO
程序员文章站
2022-05-02 08:16:58
...
判断用户输入的是 Yes 或 NO
#!/bin/bash
read -p "Are you sure?[y/n]:" sure
case $sure in
y|Y|Yes|YES)
echo "you enter $a";;
n|N|NO|no)
echo "you enter $a";;
*)
echo "error";;
esac