zsh-workers
 help / color / mirror / code / Atom feed
From: Colm Buckley <cbuckley@cs.tcd.ie>
To: zsh-workers@math.gatech.edu
Subject: Anomaly in "getopts" in 3.1.0 (possibly earlier)
Date: Mon, 30 Dec 1996 12:59:14 +0000	[thread overview]
Message-ID: <199612301259.MAA03125@picasso.cs.tcd.ie> (raw)


Hi all -

I don't know if this has been pointed out before, but 3.1.0 is
exhibiting slightly anomalous behaviour in "getopts".  It seems that a
leading "+" sign is ignored for the last option in the list, if further
arguments follow - the following should demonstrate the problem...

vangogh % cat test.zsh
#!/usr/local/bin/zsh
# Test script to demonstrate "getopts"

while getopts ":abc" opt ; do
  echo "Option is : $opt"
done
shift ((--OPTIND))
echo Remaining arguments are : $@

vangogh % test.zsh +a
Option is : +a
Remaining arguments are :
vangogh % test.zsh +ab
Option is : +a
Option is : +b
Remaining arguments are :
vangogh % test.zsh +a +b      
Option is : +a
Option is : +b
Remaining arguments are :
vangogh % test.zsh +a hello
Option is : a
Remaining arguments are : hello
vangogh % test.zsh +ab hello
Option is : +a
Option is : b
Remaining arguments are : hello
vangogh % test.zsh +a +b hello
Option is : +a
Option is : b
Remaining arguments are : hello

Notice that the '+' is removed from the final option, when there are
following arguments...  I don't think that this is the correct
behaviour.

           Colm

-- 
Colm Buckley B.F. | EMail : Colm.Buckley@tcd.ie or colm@lspace.org
Computer Science  | WWW   : http://isg.cs.tcd.ie/cbuckley/
Trinity College   | Phone : +353 87 469146 (087-469146 within Ireland)
Dublin 2, Ireland | "Microsoft : Where do you want to crash today?"


             reply	other threads:[~1996-12-30 12:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-12-30 12:59 Colm Buckley [this message]
1997-10-29 12:41 ` Peter Stephenson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=199612301259.MAA03125@picasso.cs.tcd.ie \
    --to=cbuckley@cs.tcd.ie \
    --cc=zsh-workers@math.gatech.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).