Created
December 10, 2017 05:56
-
-
Save jiro4989/64523cdadd10e09e35c89ba31504dcac to your computer and use it in GitHub Desktop.
シェルでオプション引数などの設定をする時のコード
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
# 1. caseの末尾には;;が必須 | |
# 2. s:cの:はその後に文字列が必要 | |
# 3. case内の$OPTARGで文字列を取得 | |
srcfile=? | |
compileflag=false | |
while getopts s:c opts; do | |
case $opts in | |
s) srcfile=$OPTARG;; | |
c) compileflag=true;; | |
esac | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment