Created
January 29, 2015 00:02
-
-
Save facelordgists/94d081251dd94e1db075 to your computer and use it in GitHub Desktop.
How to process dash arguments
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
while getopts ":a:" opt; do | |
case $opt in | |
a) | |
echo "-a was triggered, Parameter: $OPTARG" >&2 | |
;; | |
\?) | |
echo "Invalid option: -$OPTARG" >&2 | |
exit 1 | |
;; | |
:) | |
echo "Option -$OPTARG requires an argument." >&2 | |
exit 1 | |
;; | |
esac | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment