Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Array indirection
- X-seq: zsh-users 10779
- From: Jean-Rene David <jrdavid@xxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: Array indirection
- Date: Tue, 3 Oct 2006 13:25:45 -0400
- In-reply-to: <20061003155428.GA10503@xxxxxxxxxx>
- Mail-followup-to: zsh-users@xxxxxxxxxx
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <20061003155428.GA10503@xxxxxxxxxx>
* Wojciech Pietron [2006.10.03 12:00]:
> ==================================================
> #!/bin/zsh
>
> names=(peter ann)
> digits=(one two three four)
> analyze=(names digits)
>
> for t in $analyze; do
> for ((i=1; i<=${(P)#t}; i++)); do
> #No problems with displaying the indirect tables
> echo ${(P)t}
> done
> done
> ==================================================
>
> I have no problems with displaying the contents of the indirect table
> inside of the inner loop but how can I do the following operations there:
> - displaying i-th element of the array;
print -r -- "${(P)${t}[$i]}"
> - setting i-th element of the array.
eval "${t}[$i]=foobar"
HTH,
--
JR
Messages sorted by:
Reverse Date,
Date,
Thread,
Author