Skip to content

Instantly share code, notes, and snippets.

@ipetepete
Created June 19, 2018 17:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ipetepete/d7a0828e840741b6b64d621d3532c033 to your computer and use it in GitHub Desktop.
Save ipetepete/d7a0828e840741b6b64d621d3532c033 to your computer and use it in GitHub Desktop.
Bash script template
#!/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