Skip to content

Instantly share code, notes, and snippets.

@jgrar
Created May 13, 2014 02:01
Show Gist options
  • Save jgrar/3a5d928a5390fa0b2fe0 to your computer and use it in GitHub Desktop.
Save jgrar/3a5d928a5390fa0b2fe0 to your computer and use it in GitHub Desktop.
#!/bin/sh
while getopts "ab-:" opt
do
case "${opt}" in
-)
case "${OPTARG}" in
foo) echo foo;;
bar) echo bar;;
esac
;;
a)
echo a;;
b)
echo b;;
esac
done
shift $((OPTIND - 1))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment