xref: /freebsd/bin/sh/tests/builtins/getopts4.0 (revision e0c4386e7e71d93b0edc0c8fa156263fc4a8b0b6)
1
2set -- -x
3opt=not
4getopts x opt
5r1=$? OPTIND1=$OPTIND opt1=$opt
6getopts x opt
7r2=$? OPTIND2=$OPTIND
8[ "$r1" = 0 ] && [ "$OPTIND1" = 2 ] && [ "$opt1" = x ] && [ "$r2" != 0 ] &&
9	[ "$OPTIND2" = 2 ]
10