Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: getopts doesn't update OPTIND when called from function



On Jun 5,  8:46am, Roman Neuhauser wrote:
} Subject: Re: getopts doesn't update OPTIND when called from function
}
} i have a problem similar to Martijn's, only there's no function in sight.
} this diff shows how zsh (5.0.7, emulate -R sh) differs from other shells,
} and the standard IIUC:

I believe this was previously discussed here:

  http://www.zsh.org/mla/workers//2015/msg00196.html

The key text:

> In zsh, if you add a SECOND call to getopts in the example function,
> you will find that the second call DOES exit with a value of 1, and
> that WHEN zsh getopts exits with a return value greater than zero,
> THEN the value of OPTIND is set as POSIX specifies.

No one responded with an opinion of whether this conforms to the literal
specification or not.

-- 
Barton E. Schaefer



Messages sorted by: Reverse Date, Date, Thread, Author