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


Groups > gnu.bash.bug > #11877

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

Path csiph.com!xmission!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:54:32 -0600
Lines 33
Approved bug-bash@gnu.org
Message-ID <mailman.2284.1447444490.7904.bug-bash@gnu.org> (permalink)
References <535058272b68c9459882c6bd4565b428.squirrel@webmail.oplink.net> <CANaoh6K=OB7YAeFftc=a3ypYTz0jHPBjCok0KqR=a9pi2-pDPw@mail.gmail.com>
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 1447444491 17817 208.118.235.17 (13 Nov 2015 19:54:51 GMT)
X-Complaints-To action@cs.stanford.edu
Cc "bug-bash@gnu.org" <bug-bash@gnu.org>, Griff Miller II <griff.miller@oplink.net>
To "Dennis Williamson" <dennistwilliamson@gmail.com>
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=sry272B5yBJ+FUGl7B8GG4ytMyi7gRcRzW5FVKJuiM8=; b=IDLDqQaLtwbUe7XKcZBmJrQCL9 XUt2WFviiDtBH7M4HzFyFtkbSygAUllexAVEPFy9dt+ziFbfefRiIyaxEvQmg9SAL7nMnVjLzUHUL 8jn1NQl7CrQiJ1pBQ0/QIaTH+ot4zHQ0JnPcisvZhGCeVs/uQwcxCw63CNUxyFrlS9xU=;
In-Reply-To <CANaoh6K=OB7YAeFftc=a3ypYTz0jHPBjCok0KqR=a9pi2-pDPw@mail.gmail.com>
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+K3F8ctOqie4CodWRE/l6e02TEUk5sTIDXPWlFdaGOH191uXjgjQN/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 ARHRi6XGuAluI1udprEFZG3LO9fkj7mb1+yRqli/d+zCSxvHphGqsF3hVtrEAf060QZ1FCJg7pbn CIpFp9M/hyUYo7G4LptAg5oSVRfFcobWokYzpFpNjdVH7bJEoA==
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.07)
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:11877

Show key headers only | View raw


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 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:54 -0600

csiph-web