Skip to content

Instantly share code, notes, and snippets.

@MartenH
Created April 2, 2020 07:09
Show Gist options
  • Save MartenH/1defc297dd855a64aac402521b3654a8 to your computer and use it in GitHub Desktop.
Save MartenH/1defc297dd855a64aac402521b3654a8 to your computer and use it in GitHub Desktop.
Bash, select
#!/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