Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: zsh array subscripting with ksh comp behaviour



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