Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #11878 > unrolled thread

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

Started by"Griff Miller II" <griff.miller@oplink.net>
First post2015-11-13 13:57 -0600
Last post2015-11-13 13:57 -0600
Articles 1 — 1 participant

Back to article view | Back to gnu.bash.bug

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Possible bug in getopts when required argument is not supplied "Griff Miller II" <griff.miller@oplink.net> - 2015-11-13 13:57 -0600

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

From"Griff Miller II" <griff.miller@oplink.net>
Date2015-11-13 13:57 -0600
SubjectRe: Possible bug in getopts when required argument is not supplied
Message-ID<mailman.2285.1447444647.7904.bug-bash@gnu.org>
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?

[toc] | [standalone]


Back to top | Article view | gnu.bash.bug


csiph-web