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

Re: Subscripting without temporaries



On Apr 13,  7:14pm, DervishD wrote:
>     Hi Bart :)

'Lo.

> I tried the same using more or less what you suggests below, but I
> didn't get far because I cannot do $array[EXP][Whatever] (well,
> namely I was trying ${array[10]}[1,8], but zsh told me 'no matches
> found').

Heh.  You *can* do ${array[EXP][Whatever]},
or you can do ${${array[EXP]}[Whatever]},
but you can't do what you said you tried.

schaefer[228] array=( "this text [that text] those texts"
array> "more text [less text] some text"
array> "any text [other text] neither text" )
schaefer[229] print ${array[2][(r)\[,(R)\]]}
[less text]

Also there was a bug until recently where if EXP is a negative number,
then the result of $array[EXP] is still an array rather than a string,
so then the [Whatever] fails to slice the string.



Messages sorted by: Reverse Date, Date, Thread, Author