Skip to content

Instantly share code, notes, and snippets.

@hacker65536
Created October 24, 2016 06:10
Show Gist options
  • Save hacker65536/2b994f2a48a65dd7d515ebaa39736d00 to your computer and use it in GitHub Desktop.
Save hacker65536/2b994f2a48a65dd7d515ebaa39736d00 to your computer and use it in GitHub Desktop.
extglobsample
#!/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