Skip to content

Instantly share code, notes, and snippets.

@JeffLabonte
Last active October 8, 2019 17:18
Show Gist options
  • Save JeffLabonte/4d3d506cbec351044c20965af63ac1eb to your computer and use it in GitHub Desktop.
Save JeffLabonte/4d3d506cbec351044c20965af63ac1eb to your computer and use it in GitHub Desktop.
This is the way arguments are to handled when you have many of them!
while test $# -gt 0
do
case $1 in
--usage | --help | -h )
usage_and_exit 0
;;
--version | -v )
version
exit 0
;;
*)
error_and_usage "Unrecognized option: $1"
;;
esac
shift
done
#!/bin/bash
while getopts "f:" OPTION
do
case $OPTION in
f)
MYOPTF="$MYOPTF $OPTARG"
echo MYOPTF
;;
esac
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment