Skip to content

Instantly share code, notes, and snippets.

@sorquan
Last active August 25, 2021 14:02
Show Gist options
  • Save sorquan/667b621709cc3158831a8eab6c9cdaa4 to your computer and use it in GitHub Desktop.
Save sorquan/667b621709cc3158831a8eab6c9cdaa4 to your computer and use it in GitHub Desktop.
# Getopts - parsing arguments
while getopts "hs:c:" opt; do
case $opt in
c)
echo "Argument $opt at position $OPTIND equals $OPTARG"
;;
s)
echo "Argument $opt at position $OPTIND equals $OPTARG"
;;
h)
echo -e "$helptext"
;;
*)
echo -e "$helptext"
;;
esac
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment