#!/bin/bash
while true
do
read -r -p "Are You Sure? [Y/n] " input
case $input in
[yY][eE][sS]|[yY])
echo "Yes"
break
;;
[nN][oO]|[nN])
echo "No"
break
;;
*)
echo "Invalid input..."
;;
esac
done
参考:
#!/bin/bash
while true
do
read -r -p "Are You Sure? [Y/n] " input
case $input in
[yY][eE][sS]|[yY])
echo "Yes"
break
;;
[nN][oO]|[nN])
echo "No"
break
;;
*)
echo "Invalid input..."
;;
esac
done
参考:
本文标题:Bash 脚本——提示确认
本文链接:https://www.haomeiwen.com/subject/eptdfktx.html
网友评论