Difference between revisions of "Bash select menu"
From thelinuxwiki
(Pushed from Themanclub.) |
Latest revision as of 22:25, 25 February 2013
#!/bin/bash OPTIONS="Hello Break Exit" select opt in $OPTIONS; do if [ "$opt" = "Exit" ]; then echo "exiting script with command exit" exit elif [ "$opt" = "Hello" ]; then echo Hello World break elif [ "$opt" = "Break" ]; then echo "you chose to Break select menu and continue script" break else echo bad option, try again fi done # echo "end of script. this is printed unless you choose Exit from the menu which executes the exit command and terminates the script at that point."