Skip to content

Instantly share code, notes, and snippets.

@trepmal
Last active August 29, 2015 14:16
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 trepmal/b08b0ada5e04c383fe28 to your computer and use it in GitHub Desktop.
Save trepmal/b08b0ada5e04c383fe28 to your computer and use it in GitHub Desktop.
#!/bin/bash
ARGS=$(getopt -o a:b -l "ay:,bee:,dry-run" -n "cli.sh" -- "$@");
eval set -- "$ARGS";
while (("$#")); do
case "$1" in
-a|--ay)
shift;
if [ -n "$1" ]; then
ay=$1
shift;
fi
;;
-b|--bee)
shift;
if [ -n "$1" ]; then
bee=$1
shift;
fi
;;
--dry-run)
dryrun=1
shift;
;;
--)
shift;
break;
;;
esac
done
if [ ! -z $dryrun ]
then
echo 'DRY RUN!'
echo 'Explain what will happen without making any changes'
exit;
else
echo 'PROCEED'
echo " Ay: $ay"
echo " Bee: $bee"
echo " Other: $@"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment