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

Array indirection



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



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