Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
getopts / OPTIND / shift : inconsistent behavior
- X-seq: zsh-users 12290
- From: "謝步遙 Sie, Bu Yau" <ps@xxxxxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: getopts / OPTIND / shift : inconsistent behavior
- Date: Wed, 5 Dec 2007 16:08:26 +1100
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
Hi,
With zsh 4.3.4 the OPTIND incremental bebavior is inconsistent for options
with argument and without argument. For option with argument, OPTIND points
to next argument, while for option without argument it points to current
argument.
func() {
getopts a:b optvar
shift $(( OPTIND -1 ))
echo "$OPTIND, $1"
}
func -a x y z
output: 3, y
func -b x y z
output: 1, -b
Is this a bug? There is no consistent way to do "shift" as such.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author