Skip to content

Instantly share code, notes, and snippets.

@binzeehale
Created October 25, 2018 06:31
Show Gist options
  • Save binzeehale/6bce783ad91c512e57737e0dd5e900b4 to your computer and use it in GitHub Desktop.
Save binzeehale/6bce783ad91c512e57737e0dd5e900b4 to your computer and use it in GitHub Desktop.
#!/bin/bash
usage() { echo "Usage: $0 [-s <45|90>] [-p <string>]" 1>&2; exit 1; }
while getopts ":s:p:" o; do
case "${o}" in
s)
s=${OPTARG}
((s == 45 || s == 90)) || usage
;;
p)
p=${OPTARG}
;;
*)
usage
;;
esac
done
shift $((OPTIND-1))
if [ -z "${s}" ] || [ -z "${p}" ]; then
usage
fi
echo "s = ${s}"
echo "p = ${p}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment