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

Re: "getopts" bugs and bad interactions with "shift"



Bart Schaefer wrote:
>Question:  Is "getopts" based on some standard or emulated behavior of
>some other shell, or is it strictly a zsh thing?

It's in POSIX.2.  My rewrite was an attempt to directly implement
the text of the standard.  (I no longer have access to the standard,
unfortunately.)  As you can tell from the code, the standard definition
is pretty unpleasant.  There are places where it's not clear what state
is stored in parameters and what is supposed to be hidden, and the text
doesn't address the issue of multiple consecutive uses of getopts at all.
I wouldn't be surprised if there are actually bugs in the standard.

-zefram



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