Created
August 28, 2012 05:27
-
-
Save opie4624/3495209 to your computer and use it in GitHub Desktop.
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
#!/bin/bash | |
while getopts "vdn:b:" opt; do | |
case $opt in | |
h) | |
echo "usage: $0 [-h] [-v] [-d] [-n skip] [-b parallel]" | |
exit | |
;; | |
v) | |
echo "Verbose was triggered, Parameter: $OPTARG" | |
verbose=1 | |
;; | |
d) | |
echo "Dry Run was triggered, Parameter: $OPTARG" | |
dryrun=1 | |
;; | |
n) | |
echo "Skip was triggered, Parameter: $OPTARG" | |
skip=$OPTARG | |
;; | |
b) | |
echo "Parallel was triggered, Parameter: $OPTARG" | |
para=$OPTARG | |
;; | |
\?) | |
echo "Invalid option: -$OPTARG" | |
exit 1 | |
;; | |
:) | |
echo "Option -$OPTARG requires an argument." | |
exit 1 | |
;; | |
esac | |
done | |
# Clear all options and reset the command line | |
shift $(( OPTIND -1 )) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment