Last active
August 9, 2020 19:39
-
-
Save takakd/49a7f9a9be86a3ca81d255ea36898288 to your computer and use it in GitHub Desktop.
my_shell_script_template.sh
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
#!/usr/bin/env bash | |
# Ref: https://qiita.com/koara-local/items/2d67c0964188bba39e29 | |
# Ref: https://qiita.com/mashumashu/items/f5b5ff62fef8af0859c5 | |
SCRIPT_DIR=$(cd $(dirname $0); pwd) | |
function usage() { | |
cat <<_EOT_ | |
Usage: | |
$0 Command | |
Example. | |
$0 new | |
Command: | |
new Create new article. | |
run Run local server. | |
deploy Push to repository and deploy. | |
_EOT_ | |
exit 1 | |
} | |
# | |
new() { | |
echo new command. | |
} | |
# | |
run() { | |
echo run command. | |
} | |
# | |
deploy() { | |
echo deploy command. | |
} | |
if [[ $# -lt 1 ]]; then | |
usage | |
fi | |
if [[ $1 = "new" ]]; then | |
new | |
elif [[ $1 = "run" ]]; then | |
run | |
elif [[ $1 = "deploy" ]]; then | |
deploy | |
else | |
usage | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment