On Tuesday, November 18, 2025, anonymous <[email protected]> wrote:
>
>         f) f_flag=1; shift;;



> Is my understanding flawed or am I missing something really simple here?
>

You're not supposed to shift there. The document you linked says:

If the application sets *OPTIND* to the value 1, a new set of parameters
can be used: either the current positional parameters or new *arg* values.
Any other attempt to invoke *getopts* multiple times in a single shell
execution environment with parameters (positional parameters or *arg* operands)
that are not the same in all invocations, or with an *OPTIND* value
modified to be a value other than 1, produces unspecified results.



-- 
Oğuz

Reply via email to