zsh-users
 help / color / mirror / code / Atom feed
From: Jean-Rene David <jrdavid@magma.ca>
To: zsh-users@sunsite.dk
Subject: Re: Array indirection
Date: Tue, 3 Oct 2006 13:25:45 -0400	[thread overview]
Message-ID: <20061003172545.GB15118@princo> (raw)
In-Reply-To: <20061003155428.GA10503@itl.waw.pl>

* 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


      reply	other threads:[~2006-10-03 17:26 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-03 15:54 Wojciech Pietron
2006-10-03 17:25 ` Jean-Rene David [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20061003172545.GB15118@princo \
    --to=jrdavid@magma.ca \
    --cc=zsh-users@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).