Marc Espie:
> > Switch the argument parsing from the deprecated getopt to getopts.
> >
> Not before I see actual documentation pointing to getopts
>
> Specifically: I wasn't even aware getopts existed.
>
> It is a built-in in sh (ksh ?)
It's a POSIX shell built-in, so no separate man page. It's documented
in sh(1) and ksh(1).
(Historically, it was introduced in AT&T ksh88, I think. POSIX
then picked it up due to the inherent deficiencies of getopt. It
was already in the Almquist shell when that one was imported into
the CSRG repository in 1991 as 4.4BSD's sh. It has been the successor
to the deprecated getopt for some thirty years.)
> getopt(1) doesn't mention it as an alternative.
>
> Oh, and sh(1) doesn't contain any usable example.
The go-to example is in the POSIX text.
> I would just like it to be properly documented so that this code
> doesn't appear out-of-the-blue first.
Yes, hmm.
--
Christian "naddy" Weisgerber naddy@mips.inka.de
No comments:
Post a Comment