Created
December 2, 2015 19:44
-
-
Save fernyb/b5347b947b1c24d72ac2 to your computer and use it in GitHub Desktop.
Bash option parsing
This file contains hidden or 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
DEBUG=false | |
UDID=0 | |
while [[ $# > 0 ]] | |
do | |
key="$1" | |
#echo $key | |
case $key in | |
-d|--debug) | |
DEBUG=true | |
;; | |
-u|-udid) | |
shift | |
UDID=$1 | |
;; | |
--default) | |
DEFAULT=true | |
;; | |
*) | |
# unknown option | |
;; | |
esac | |
shift | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment