Created
May 24, 2020 12:52
-
-
Save takakabe/3fe31ae6612954b51da5e5643dcc6cdf 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
#!/bin/bash | |
# ↓ここを編集 | |
while getopts w-:h-: opt; do | |
optarg="${OPTARG}" | |
if [[ "${opt}" = - ]]; then | |
opt="-${OPTARG%%=*}" | |
optarg="${OPTARG/${OPTARG%%=*}/}" | |
optarg="${optarg#=}" | |
set +u | |
if [[ -z "${optarg}" ]] && [[ ! "${!OPTIND}" = "-*" ]]; then | |
optarg="${!OPTIND}" | |
shift | |
fi | |
fi | |
# ↓ここも編集 | |
case "-${opt}" in | |
-w|--wawawa) | |
echo 'wawawa' | |
;; | |
-h|--help) | |
echo 'usage' | |
;; | |
esac | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment