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