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