1 set -- -q -w e -r -t -y
2 echo "*** no OPTIND, optstring:'w:et' args:$*"
5 while getopts "w:et" var; do
6 echo "var:'$var' OPTIND:$OPTIND OPTARG:'$OPTARG'"
9 echo "exited: var:'$var' OPTIND:$OPTIND OPTARG:'$OPTARG'"
11 set -- -w 1 -w2 -w -e -e -t -t
12 echo "*** OPTIND=0, optstring:'w:et' args:$*"
14 while getopts "w:et" var; do
15 echo "var:'$var' OPTIND:$OPTIND OPTARG:'$OPTARG'"
18 echo "exited: var:'$var' OPTIND:$OPTIND OPTARG:'$OPTARG'"