Skip to content

Instantly share code, notes, and snippets.

@chilicat
Created September 29, 2013 09:14
Show Gist options
  • Save chilicat/6750767 to your computer and use it in GitHub Desktop.
Save chilicat/6750767 to your computer and use it in GitHub Desktop.
Simple Bash Shell Option Arguments Commandline Implementation
#!/bin/sh
while true
do
case "$1" in
-n|--name) name=$2; shift 2;;
-d|--debug) debug=1; shift 1;;
--) shift 1; break ;;
*) break ;;
esac
done
echo "Name $name"
echo "Debug $debug"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment