Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Anomaly in "getopts" in 3.1.0 (possibly earlier)
- X-seq: zsh-workers 2672
- From: Colm Buckley <cbuckley@xxxxxxxxx>
- To: zsh-workers@xxxxxxxxxxxxxxx
- Subject: Anomaly in "getopts" in 3.1.0 (possibly earlier)
- Date: Mon, 30 Dec 1996 12:59:14 +0000
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@xxxxxx or colm@xxxxxxxxxx
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?"
Messages sorted by:
Reverse Date,
Date,
Thread,
Author