bug-bash
[Top][All Lists]
Advanced

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

Re: Possible bug in getopts when required argument is not supplied


From: Griff Miller II
Subject: Re: Possible bug in getopts when required argument is not supplied
Date: Fri, 13 Nov 2015 13:57:10 -0600
User-agent: SquirrelMail/1.5.2 [SVN]

On Fri, November 13, 2015 12:56 pm, Greg Wooledge wrote:
> On Fri, Nov 13, 2015 at 10:13:15AM -0600, Griff Miller II wrote:
>
>> % ./myscript -a -b b
>>
>>
>> Note that in the last run, getopts does not detect that nothing was
>> passed via -a, even though -a requires it. Instead, it thinks the next
>> switch (-b) is the value of -a. Perhaps this was a conscious decision,
>>
>
> Yes, it is.
>
>
> If you want your script to disallow arguments of -a that begin with a
> hyphen character, you will have to check for that yourself.

Well, there you go.  :)  Thanks for replying. I do currently have just
such a workaround implemented. Any chance of making this behavior clearer
in the man page?




reply via email to

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