6e76445cf7
When getopts finds an invalid option or a missing option-argument, it should not reset its state and should set OPTIND as normal. This is an old ash bug that was fixed long ago in dash. Our behaviour now matches most other shells.
8 lines
125 B
Plaintext
8 lines
125 B
Plaintext
# $FreeBSD$
|
|
|
|
set -- -x -y
|
|
getopts :x var || echo "First getopts bad: $?"
|
|
getopts :x var
|
|
r=$?
|
|
[ r != 0 ] && [ "$OPTIND" = 3 ]
|