Skip to content

Instantly share code, notes, and snippets.

@GregGallant
Last active August 29, 2015 14:06
Show Gist options
  • Save GregGallant/4ab3126c4774df3e6db9 to your computer and use it in GitHub Desktop.
Save GregGallant/4ab3126c4774df3e6db9 to your computer and use it in GitHub Desktop.
Be Bash Awesome... every shell script should have something similar
pparam=$@;
if [ -z "$pparam" ]; then
echo "Usage: beAwesome.sh --[prod,stage]"; exit 1;
fi
for opt in $@; do
case $opt in
"--prod")
echo "Production run";
DATABASE=seriousAwesome;
#...
;;
"--stage")
echo "Staging run";
DATABASE=almostAwesome;
#...
;;
*)
echo "Invalid parameter: $opt";
echo "Usage: beAwesome.sh --[prod,stage] \n\n";
exit 1;
;;
esac
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment