help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-bash] Allow getopts to do what is capable with getopt?


From: Greg Wooledge
Subject: Re: [Help-bash] Allow getopts to do what is capable with getopt?
Date: Wed, 25 Mar 2015 09:08:47 -0400
User-agent: Mutt/1.4.2.3i

On Tue, Mar 24, 2015 at 08:28:34PM -0500, Peng Yu wrote:
> I am referring to util-linux'
> getopt.

I do not support the unnecessary addition of this bloat into bash as
a builtin.

And using getopt in a script is atrociously stupid UNLESS you have TESTED
that the getopt you are invoking is in fact the non-standard Linux one.
The amount of code you would have to add to test this, in order to be
sure that it is safe to use, is large enough that you would be better
off simply writing a normal option processing loop using the standard
tools instead.  (And it would run faster, too, because you wouldn't have
to fork an external command... repeatedly... to process your options.)

If your program is so incredibly complex that you feel you need Linux
getopt to handle its options, then perhaps you should rewrite it in a
more advanced programming language than bash.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]