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


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

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

Started byGreg Wooledge <wooledg@eeg.ccf.org>
First post2015-11-13 13:56 -0500
Last post2015-11-13 13:56 -0500
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 Greg Wooledge <wooledg@eeg.ccf.org> - 2015-11-13 13:56 -0500

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

FromGreg Wooledge <wooledg@eeg.ccf.org>
Date2015-11-13 13:56 -0500
SubjectRe: Possible bug in getopts when required argument is not supplied
Message-ID<mailman.2281.1447440983.7904.bug-bash@gnu.org>
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.

[toc] | [standalone]


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


csiph-web