Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Iterating over a set of arrays
>>
>> arrayA=(a1 a2 a3)
>> arrayB=(b1 b2 b3)
>> arrayC=(c1 c2 c3)
>
> for a in array{A,B,C}; do
> print ${${(P)a}[2]}
> done
>
setopt interactivecomments
# messing around a little with above
for a (array{A,B,C}) echo ${${(P)a}[2]}
# or in this case same thing
for a (array{A,B,C}) echo ${${(P)a}[-2]}
# or with a little formatting
for a (array{A,B,C}) echo ${${(PUl:5::.:r:5::.:)a}[-2]}
--
zzapper
https://twitter.com/dailyzshtip
---
This email is free from viruses and malware because avast! Antivirus protection is active.
http://www.avast.com
Messages sorted by:
Reverse Date,
Date,
Thread,
Author