drop-in replacement for GNU getopt implemented in pure Bash