1set -- -q -w -e r -t -y
2echo "*** no OPTIND, optstring:'we' args:$*"
3var=QWERTY
4while getopts "we" var; do
5 echo "var:'$var' OPTIND:$OPTIND"
6done
7# unfortunately, "rc:0" is shown since while's overall exitcode is "success"
8echo "exited: var:'$var' OPTIND:$OPTIND"
9