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


Groups > gnu.bash.bug > #11878

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

Path csiph.com!optima2.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!usenet.stanford.edu!not-for-mail
From "Griff Miller II" <griff.miller@oplink.net>
Newsgroups gnu.bash.bug
Subject Re: Possible bug in getopts when required argument is not supplied
Date Fri, 13 Nov 2015 13:57:10 -0600
Lines 22
Approved bug-bash@gnu.org
Message-ID <mailman.2285.1447444647.7904.bug-bash@gnu.org> (permalink)
References <535058272b68c9459882c6bd4565b428.squirrel@webmail.oplink.net> <20151113185616.GH27325@eeg.ccf.org>
NNTP-Posting-Host lists.gnu.org
Mime-Version 1.0
Content-Type text/plain;charset=iso-8859-1
Content-Transfer-Encoding 8bit
X-Trace usenet.stanford.edu 1447444647 17970 208.118.235.17 (13 Nov 2015 19:57:27 GMT)
X-Complaints-To action@cs.stanford.edu
Cc bug-bash@gnu.org, Griff Miller II <griff.miller@oplink.net>
To "Greg Wooledge" <wooledg@eeg.ccf.org>
Envelope-to bug-bash@gnu.org
DKIM-Signature v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=oplink.net; s=default; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:To:From: Subject:Date:References:In-Reply-To:Message-ID; bh=JaAzJ8ZKuNS/mKSVvIm/eixqXlwc8NeX9x3x4ajl9nw=; b=GsGNQmvulcUr4m9zpY9+eSdy5F dmLOy8IO3BLbSxBpYjjY+Gj5xkD2Iit8TdgvQTsvKlsfs+FncTLLoyVFLNOLsgXDNcZUB96993u21 hIutKFUMYN09mIFBZW3AypCMkBnRCb6UtUvE7Bzekcovzi/XbXzxs86ffcr42iFkfH+s=;
In-Reply-To <20151113185616.GH27325@eeg.ccf.org>
User-Agent SquirrelMail/1.5.2 [SVN]
X-AntiAbuse This header was added to track abuse, please include it with any abuse report
X-AntiAbuse Primary Hostname - cpanel1.oplink.net
X-AntiAbuse Original Domain - gnu.org
X-AntiAbuse Originator/Caller UID/GID - [47 12] / [47 12]
X-AntiAbuse Sender Address Domain - oplink.net
X-Get-Message-Sender-Via cpanel1.oplink.net: authenticated_id: griff.miller@oplink.net
X-Authenticated-Sender cpanel1.oplink.net: griff.miller@oplink.net
X-Source
X-Source-Args
X-Source-Dir
X-Filter-ID s0sct1PQhAABKnZB5plbIT50OT5zrCXWMgnOPri5Rsyv4UAD9srRy7CsKvBiFIJUXewBu5TuhjJr gH3eyFBy7nRTh2x4czFsyWi02C6IOpqixGGqP+aNBDHPompdpVJGwnPxZ9F4epQ52HWf889wXCmC AwVgJ7O+K3F8ctOqie4mGdu1gca/7G45wsycVVPmXPWlFdaGOH191uXjgjQN/ZW/ux/C+1BT4XrA ZnOFvpmzxQlbngCLuJt576uaV4jSCrfVQmylutQTt5q+2gt0CIHElz4uuB1vUyx2xNcRnLAAObiP uFHBBo76mqNjlusTVgQ2dYQJ3VWrUdOP3MyWJ+/zQGLR6FNUcSp4kI1exRngOQHTwtOQMdChmanG UmeK/OL5JjK+M3G1xdmtrmYEFmWyisqb9EBCbrK+u2DaLBcaVYuvXXjnIQ9UbG2xl1SQsFdeAnz4 j2Jd9hHlkVeQ3ZgkN3eey6+2LcwPX57eiWBOuAjQzRJZPWVEwiTZ70tVRl8FMkZlwD1OT/TKB30H PoPAgTtUp75uqlx0KezvZHVYj9aVJkTvZXZNiU23F2+UgwGuXf/RcrjZvMON2cBP6miH1Wgh6RAe nBR+licROGaIMuHQ7Q0ctlj27TjTmXwn7DL5o1MlNCrzWNnLuSRxyLbU1LZIPOttXZ/5N7yxhWh4 VIDKaD4XDqKjHHRLJLgz
X-Report-Abuse-To spam@filter01.reliabledns.org
X-Filter-Fingerprint IFrWXGses7OKB5S5G8/dJUb3OPwsHaH0Fvg5oXltHd9A3cTUQ1R++keuE7RDJ8Kg3RbMLUalw1oC mj99/u+PoqoVy8a3lsStJtAvpObFX0Wok1JBYnOLzfRIhlEHQynLUpndEJ0YoaLytXXo8BMTaVt0 ARHRi6XGuAluI1udprFy32DUYpEhA3j9NJFmItfypuoazoDH3m92PL21GfhFYWcYmGLKZUTyGy/B A6iJtsD8WFC+rpTT4JYvoDjVeZUw3fI9smEy0EupqfCN6sn6Zg==
X-Originating-IP 216.230.224.98
X-SpamExperts-Domain outbound.oplink.net
X-SpamExperts-Username 216.230.224.98
Authentication-Results reliabledns.org; auth=pass smtp.auth=216.230.224.98@outbound.oplink.net
X-SpamExperts-Outgoing-Class ham
X-SpamExperts-Outgoing-Evidence Combined (0.06)
X-Recommended-Action accept
X-detected-operating-system by eggs.gnu.org: GNU/Linux 3.x
X-Received-From 199.192.217.36
X-BeenThere bug-bash@gnu.org
X-Mailman-Version 2.1.14
Precedence list
List-Id Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe <https://lists.gnu.org/mailman/options/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive <http://lists.gnu.org/archive/html/bug-bash>
List-Post <mailto:bug-bash@gnu.org>
List-Help <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe <https://lists.gnu.org/mailman/listinfo/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=subscribe>
Xref csiph.com gnu.bash.bug:11878

Show key headers only | View raw


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?

Back to gnu.bash.bug | Previous | Next | Find similar | Unroll thread


Thread

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

csiph-web