Created
January 15, 2016 13:28
-
-
Save glava/c2aa1ccd8c04374cf7f0 to your computer and use it in GitHub Desktop.
argument parsing
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/bash | |
while getopts ":i:o:s:" opt; do | |
case $opt in | |
s) | |
ss=$OPTARG | |
;; | |
i) | |
input=$OPTARG | |
;; | |
o) | |
output=$OPTARG | |
;; | |
\?) | |
echo "Invalid option: -$OPTARG" >&2 | |
exit 1 | |
;; | |
:) | |
echo "Option -$OPTARG requires an argument." >&2 | |
exit 1 | |
;; | |
esac | |
done | |
echo $input | |
echo $output | |
echo $ss |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment