Skip to content

Instantly share code, notes, and snippets.

@opie4624
Created August 28, 2012 05:27
Show Gist options
  • Save opie4624/3495209 to your computer and use it in GitHub Desktop.
Save opie4624/3495209 to your computer and use it in GitHub Desktop.
#!/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