Created
October 24, 2016 06:10
-
-
Save hacker65536/2b994f2a48a65dd7d515ebaa39736d00 to your computer and use it in GitHub Desktop.
extglobsample
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 | |
shopt -s extglob | |
string='@(foo|bar)' | |
read choice | |
case $choice in | |
$string ) printf 'String choice %-20s' "$choice"; ;; | |
$s1|$s2 ) printf 'Two val choice %-20s' "$choice"; ;; | |
*) printf 'A Bad choice! %-20s' "$choice"; ;; | |
esac | |
echo |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment