zsh-workers
 help / color / mirror / code / Atom feed
* Anomaly in "getopts" in 3.1.0 (possibly earlier)
@ 1996-12-30 12:59 Colm Buckley
  1997-10-29 12:41 ` Peter Stephenson
  0 siblings, 1 reply; 2+ messages in thread
From: Colm Buckley @ 1996-12-30 12:59 UTC (permalink / raw)
  To: zsh-workers


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?"


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1997-10-29 12:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-12-30 12:59 Anomaly in "getopts" in 3.1.0 (possibly earlier) Colm Buckley
1997-10-29 12:41 ` Peter Stephenson

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).