Created
September 29, 2013 09:14
-
-
Save chilicat/6750767 to your computer and use it in GitHub Desktop.
Simple Bash Shell Option Arguments Commandline Implementation
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/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