Created
April 2, 2020 07:09
-
-
Save MartenH/1defc297dd855a64aac402521b3654a8 to your computer and use it in GitHub Desktop.
Bash, select
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
all_done=0 | |
while (( !all_done )); do | |
options=("do-1" "do-2" "Quit") | |
select opt in "${options[@]}" | |
do | |
case $opt in | |
"do-1") | |
echo "do-1" | |
break | |
;; | |
"do-2") | |
echo "do-2" | |
break | |
;; | |
"Quit") | |
all_done=1 | |
break | |
;; | |
*) echo "invalid option $REPLY";; | |
esac | |
done | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment