adba77a62e
Command substitutions containing a single simple command and here-document expansion are performed in a subshell environment, but may not fork. Any modified state of the shell environment should be restored afterward. The state that OPTIND=1 had been done was not saved and restored here. Note that the other parts of shellparam need not be saved and restored, since they are not modified in these situations (a fork is done before such modifications).
12 lines
236 B
Plaintext
12 lines
236 B
Plaintext
# $FreeBSD$
|
|
|
|
set -- -x arg
|
|
opt=not
|
|
getopts x opt
|
|
r1=$? OPTIND1=$OPTIND opt1=$opt
|
|
: $(: $((OPTIND = 1)))
|
|
getopts x opt
|
|
r2=$? OPTIND2=$OPTIND
|
|
[ "$r1" = 0 ] && [ "$OPTIND1" = 2 ] && [ "$opt1" = x ] && [ "$r2" != 0 ] &&
|
|
[ "$OPTIND2" = 2 ]
|