From: Greg Klanderman <gak@klanderman.net>
To: Zsh list <zsh-workers@sunsite.dk>
Subject: bug in 'b' array parameter subscript flag
Date: Fri, 4 Sep 2009 19:13:54 -0400 [thread overview]
Message-ID: <19105.40754.702800.164855@gargle.gargle.HOWL> (raw)
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
next reply other threads:[~2009-09-04 23:14 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-04 23:13 Greg Klanderman [this message]
2009-09-05 19:07 ` Peter Stephenson
2009-09-10 3:42 ` Greg Klanderman
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=19105.40754.702800.164855@gargle.gargle.HOWL \
--to=gak@klanderman.net \
--cc=zsh-workers@sunsite.dk \
/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).