Created
June 19, 2018 17:05
-
-
Save ipetepete/d7a0828e840741b6b64d621d3532c033 to your computer and use it in GitHub Desktop.
Bash script template
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
#!/bin/bash -e | |
usage="USAGE: $0 action [marsnat version] | |
ACTIONS: | |
start - starts the docker instance [takes optional masnat version] | |
stop - stops the docker instance | |
restart - restarts the docker instance [takes optional marsnat version] | |
bash - puts you in the docker environment's bash prompt | |
" | |
ACTION="" | |
VERSION="" | |
while getopts "hs" flag; do | |
case $flag in | |
h) | |
echo "$usage" | |
exit 0 | |
;; | |
s) | |
SILENT=1 | |
;; | |
esac | |
done | |
echo "$OPTIND" | |
for (( x=1; x<$OPTIND; x++ )); do shift "$((OPTIND-1))"; done | |
ACTION="$1" | |
VERSION="$2" | |
if [ "$ACTION" == "" ]; then | |
echo "$usage" | |
exit 1 | |
fi | |
echo "action: $ACTION .... version: $VERSION" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment