Skip to content

Instantly share code, notes, and snippets.

@damc-dev
Created May 30, 2017 13:28
Show Gist options
  • Save damc-dev/527ef241c76a8c1fad50454c24aaae36 to your computer and use it in GitHub Desktop.
Save damc-dev/527ef241c76a8c1fad50454c24aaae36 to your computer and use it in GitHub Desktop.
Bash menu select option
#!/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 3"
;;
"Quit")
break
;;
*) echo invalid option;;
esac
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment