Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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} and p = ${p}"
- $# = total number of arguments / $1 is the first argument / $0 is the script itself.
- !# = last argument
Add Comment
Please, Sign In to add comment