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

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



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

getopt is part of GNU libc, and according to the info pages:

  `getopt' is more standard [than argp_parse] (the short-option only
  version of it is a part of the POSIX standard),

Virtually all GNU utilities use it.  Also, Perl has the
Getopt::{Std,Long} modules which emulates it precisely, AFAIK.  A `man
3 getopt' on my RedHat box confirms what I suspected, which is that
there is only one optstring parameter.  It also mumbles stuff about
POSIX being broken ...



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