Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: zsh array subscripting with ksh comp behaviour
- X-seq: zsh-users 19029
- From: Roman Neuhauser <neuhauser@xxxxxxxxxx>
- To: Jerry Rocteur <jerry.rocteur@xxxxxxxxx>
- Subject: Re: zsh array subscripting with ksh comp behaviour
- Date: Thu, 21 Aug 2014 16:47:10 +0200
- Cc: zsh-users@xxxxxxx
- 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>
# jerry.rocteur@xxxxxxxxx / 2014-08-21 15:54:45 +0200:
> 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
> ] echo ${arr[2]}
> two
> ] echo ${arr[3]}
> three
>
> setopt ksharrays
>
> ] echo ${arr[0]}
> one
> ] echo ${arr[1]}
> two
> ] echo ${arr[2]}
> three
> ] echo ${arr[3]}
zshparam(1):
Array Subscripts
Individual elements of an array may be selected using a subscript.
A subscript of the form `[exp]' selects the single element exp, where
exp is an arithmetic expression which will be subject to arith‐ metic
expansion as if it were surrounded by `$((...))'. The elements are
numbered beginning with 1, unless the KSH_ARRAYS option is set in
which case they are numbered from zero.
--
roman
Messages sorted by:
Reverse Date,
Date,
Thread,
Author