help-bash
[Top][All Lists]
Advanced

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

Handling getopt for option without optional argument value


From: lisa-asket
Subject: Handling getopt for option without optional argument value
Date: Fri, 23 Jul 2021 19:00:01 +0200 (CEST)

Good Evening Chet,



An maintainer of bash, I want to suggest an improvement to the capability of 
bash built-in

getopt to also handle long options, or another implementation with a different 
name if

you are worried that the changes could break people's scripts.



libc does have the long option function, whilst bash is the most widely used 
shell packaged
by default for most distributions, making the use of long options in bash 
functions

extremely useful. Many things that can be done in Gnu can be done via command 
line. 



I have many tools available on the command line that I use everyday. 





From: Chet Ramey <chet.ramey@case.edu>
To: help-bash@gnu.org
Subject: Re: Handling getopt for option without optional argument value
Date: 23/07/2021 18:33:08 Europe/Paris

On 7/23/21 11:43 AM, Greg Wooledge wrote:

> The getopts (note the 's') builtin command replaces getopt, and is not
> broken. Use that instead. Or, if you need to handle --gnu-long-opts
> or -findopts, write your own option parser. Or don't write the program
> in bash in the first place. Or STOP FEELING THAT YOU NEED --gnu-long-opts
> or -findopts in your program. Just... don't do it.
> 
> People make their own lives SO much more complicated than they need to be.
> I don't understand why.

To be fair, you don't know their full requirements. It's all about fitting
the tool to your requirements.

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU chet@case.edu http://tiswww.cwru.edu/~chet/




reply via email to

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