Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Subscript of negatively-subscripted array element gives incorrect result
- X-seq: zsh-workers 19694
- From: Jonathan Hankins <jonathan-hankins@xxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxx
- Subject: Subscript of negatively-subscripted array element gives incorrect result
- Date: Thu, 25 Mar 2004 19:56:00 -0600
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
Hi,
I reported this previously through the Bugs section on the Sourceforge page
for zsh, but wasn't sure if it was active. I also have a bit more
information.
I am getting different results taking a substring of the same array element
when I index it negatively than when I index it positively. Here is an
example:
These are correct:
% t=(foo bar baz)
% print ${t[2]}
bar
% print ${${t[2]}[1]}
b
% print ${${t[2]}[1,2]}
ba
% print ${${t[2]}[2]}
a
% print ${${t[2]}[2,3]}
ar
%
This is also correct:
% print ${t[-2]}
bar
These are not correct:
% print ${${t[-2]}[1]}
bar
% print ${${t[-2]}[1,2]}
bar
% print ${${t[-2]}[2]}
% print ${${t[-2]}[2,3]}
%
Those last 2 yield an empty string.
I verified this behavior with 4.0.4, 4.0.9, 4.1.1 and 4.2.0 on a Debian
GNU/Linux system.
Thanks!
-Jonathan Hankins
Messages sorted by:
Reverse Date,
Date,
Thread,
Author