diff options
Diffstat (limited to 'miscripts/choice.sh')
-rw-r--r-- | miscripts/choice.sh | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/miscripts/choice.sh b/miscripts/choice.sh new file mode 100644 index 0000000..c2f4e16 --- /dev/null +++ b/miscripts/choice.sh @@ -0,0 +1,23 @@ +#!/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
\ No newline at end of file |