-
-
Save oakaigh/321c8c60d453c5d69fe852371d3c1c74 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
wickJSON () { | |
key=$1 | |
re="\"($key)\": \"([^\"]*)\"" | |
while read -r l; do | |
if [[ $l =~ $re ]]; then | |
name="${BASH_REMATCH[1]}" | |
value="${BASH_REMATCH[2]}" | |
echo "$name=$value" | |
else | |
return -1 | |
fi | |
done | |
} | |
prompt="Pick an option:" | |
options=("A" "B" "C") | |
PS3="$prompt " | |
select opt in "${options[@]}" "Quit"; do | |
case "$REPLY" in | |
1 ) echo "You picked $opt which is option $REPLY";; | |
2 ) echo "You picked $opt which is option $REPLY";; | |
3 ) echo "You picked $opt which is option $REPLY";; | |
$(( ${#options[@]}+1 )) ) echo "Goodbye!"; break;; | |
*) echo "Invalid option. Try another one.";continue;; | |
esac | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment