zsh-users
 help / color / mirror / code / Atom feed
From: Wojciech Pietron <W.Pietron@itl.waw.pl>
To: zsh-users@sunsite.dk
Subject: Array indirection
Date: Tue, 3 Oct 2006 17:54:29 +0200	[thread overview]
Message-ID: <20061003155428.GA10503@itl.waw.pl> (raw)

ZSH_VERSION=4.0.2

Hello,

I need to analyze a couple of arrays and decided to take advantage of
indirection:

==================================================
#!/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;
- setting i-th element of the array.

I would appreciate any help.
Best regards,
Wojciech Pietron


             reply	other threads:[~2006-10-03 15:56 UTC|newest]

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

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=20061003155428.GA10503@itl.waw.pl \
    --to=w.pietron@itl.waw.pl \
    --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).