Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > gnu.bash.bug > #11877 > unrolled thread
| Started by | "Griff Miller II" <griff.miller@oplink.net> |
|---|---|
| First post | 2015-11-13 13:54 -0600 |
| Last post | 2015-11-13 13:54 -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.
Re: Possible bug in getopts when required argument is not supplied "Griff Miller II" <griff.miller@oplink.net> - 2015-11-13 13:54 -0600
| From | "Griff Miller II" <griff.miller@oplink.net> |
|---|---|
| Date | 2015-11-13 13:54 -0600 |
| Subject | Re: Possible bug in getopts when required argument is not supplied |
| Message-ID | <mailman.2284.1447444490.7904.bug-bash@gnu.org> |
On Fri, November 13, 2015 1:02 pm, Dennis Williamson wrote: > Your opts string needs to begin with a colon to enable silent error > reporting and you need to handle the colon in your case statement as the > condition where a required argument is missing. Hi, Dennis - thanks for replying. I get the same behavior with silent reporting. My real script where I discovered this behavior actually uses silent reporting - I didn't use it in my example to keep things simple. > Snippets: > > > opts=:a:b:c > > > :) echo "Missing argument for option -$OPTARG" >&2;; > > > You should escape the question mark since otherwise it's a globbing > character: You are right! I missed that when throwing together my example script. > \?) echo "Unknown option: -$OPTARG" >&2; exit 1;; > > > -- > Visit serverfault.com to get your system administration questions > answered. >
Back to top | Article view | gnu.bash.bug
csiph-web