Dear maintainer, With bash 5.1-2+b3, the output of getopts abc opt hello; EC=$?; echo $opt $OPTIND $EC is y 1 1
The value of $OPTIND is correct now.But as already mentioned, $opt == x was strange, and the same holds for $opt == y now.
The bash manual states that if the first non-option arg is encountered, opt is set to ?,
so this is another bug.For me, it's irrelevant since I don't use the value of $opt after getopts has exited with a non-zero exit value,
but maybe it's relevant to others.