问题是我想要与此类似的东西,但是相反,它将带给您数字,例如:
1)Choice1
2)Choice2
3)Choice3
4)退出
任何人都可以帮助解决这个问题,或者可以让我更轻松一点,这将不胜感激!
#!/bin/bash
# Bash Menu Script Example
PS3='Please enter your choice: '
options=("Option 1" "Option 2" "Option 3" "Quit")
select opt in "${options[@]}"
do
case $opt in
"Option 1")
echo "you chose choice 1"
;;
"Option 2")
echo "you chose choice 2"
;;
"Option 3")
echo "you chose choice $REPLY which is $opt"
;;
"Quit")
break
;;
*) echo "invalid option $REPLY";;
esac
done