Skip to content

Instantly share code, notes, and snippets.

@efim-a-efim
Last active August 29, 2015 13:58
Show Gist options
  • Save efim-a-efim/9931101 to your computer and use it in GitHub Desktop.
Save efim-a-efim/9931101 to your computer and use it in GitHub Desktop.
Parses script/function options. Simple parsing, just for reference
#!/bin/bash
local _optstring=':f:'
while getopts "${_optstring}" _opt; do
case "${_opt}" in
f)
_f="${OPTARG}"
;;
*)
return 255
;;
esac
done
shift $((${OPTIND}-1))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment