Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
bug in 'b' array parameter subscript flag
- X-seq: zsh-workers 27242
- From: Greg Klanderman <gak@xxxxxxxxxxxxxx>
- To: Zsh list <zsh-workers@xxxxxxxxxx>
- Subject: bug in 'b' array parameter subscript flag
- Date: Fri, 4 Sep 2009 19:13:54 -0400
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- Reply-to: gak@xxxxxxxxxxxxxx
when the 'b' flag is used with the 'i' flag, and there are no elements
to be searched, '0' is incorrectly returned rather than one plus the
array length:
[~] phl| zsh -f
phl% echo $ZSH_VERSION
4.3.10-dev-1
phl% echo $ZSH_PATCHLEVEL
1.4718
phl% unsetopt ksharrays
phl% a=(bar)
phl% echo $#a
1
phl% echo ${a[(ib:2:)foo]} ## BUG: this should return 2
0
phl% echo ${a[(i)foo]} ## just like this
2
the 'b' flag works correctly when the number of elements to be
searched is non-zero:
phl% a=(bar baz)
phl% echo $#a
2
phl% echo ${a[(ib:2:)foo]}
3
also, the 'i' flag alone, with no elements to search works correctly:
phl% a=()
phl% echo $#a
0
phl% echo ${a[(i)foo]}
1
cheers,
greg
Messages sorted by:
Reverse Date,
Date,
Thread,
Author