Last active
August 29, 2015 14:05
-
-
Save tkfm-yamaguchi/5c94d4f3a96813271565 to your computer and use it in GitHub Desktop.
getopts is a command of sh/bash
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 -x | |
while getopts d opt; do | |
case $opt in | |
d) DEBUG="y" ;; | |
esac | |
done | |
if [ -z $DEBUG ]; then | |
echo "NO DEBUG" | |
else | |
echo "DEBUG" | |
fi | |
# it could get another arguments | |
shift $((OPTIND - 1)) | |
echo ${1} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment