Created
March 18, 2014 05:12
-
-
Save siroken3/9613918 to your computer and use it in GitHub Desktop.
bashでgetopts 使うテンプレ
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
| aaa="" | |
| bbb="" | |
| function errorexit() | |
| { | |
| echo $1 | |
| exit | |
| } | |
| function usage() | |
| { | |
| errorexit "${0} -a aaa -b bbb" | |
| } | |
| while getopts :a:b OPT | |
| do | |
| case $OPT in | |
| a) aaa=$OPTARG | |
| ;; | |
| b) bbb=$OPTARG | |
| ;; | |
| *) usage | |
| ;; | |
| esac | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment