Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: zsh array subscripting with ksh comp behaviour
- X-seq: zsh-users 19030
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Zsh Users <zsh-users@xxxxxxx>, jerry.rocteur@xxxxxxxxx
- Subject: Re: zsh array subscripting with ksh comp behaviour
- Date: Thu, 21 Aug 2014 12:47:28 -0700
- In-reply-to: <CAGAAoy2-y7635O+wtC2ToocZ9_Mhze70WrrXLwFZ=4-UiC9e7w@mail.gmail.com>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <CAGAAoy2-y7635O+wtC2ToocZ9_Mhze70WrrXLwFZ=4-UiC9e7w@mail.gmail.com>
On Aug 21, 2014 6:57 AM, "Jerry Rocteur" <jerry.rocteur@xxxxxxxxx> wrote:
>
> I have noticed something strange, it is easy to solve but should this
> really be default behaviour, I thought I'd report it.
>
> ] arr=(one two three)
> ] echo ${arr[0]}
> one
> ] echo ${arr[1]}
> one
Is the behavior you find strange (a) that ${arr[0]} is "one" or (b) that
${arr[1]} is not "two"?
If (a) you may be happy to hear that this has been changed in more recent
zsh releases, so that (without ksharrays set) ${arr [0]} is the empty
string, as with any other index that is outside the array bounds.
If (b) then this has already been explained as zsh's normal 1-based
indexing (again, without ksharrays).
Messages sorted by:
Reverse Date,
Date,
Thread,
Author