Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: printing arrays and index
- X-seq: zsh-users 9138
- From: zzapper <david@xxxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: printing arrays and index
- Date: Sun, 24 Jul 2005 07:46:45 +0100
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <gcd2e1pr6d3s08cad77b1f6j3j11d2dgpd@xxxxxxx> <1050723045916.ZM10289@xxxxxxxxxxxxxxxxxxxxxxx>
- Sender: news <news@xxxxxxxxxxxxx>
On Sat, 23 Jul 2005 04:59:15 +0000, wrote:
>On Jul 22, 7:08pm, zzapper wrote:
>} Subject: printing arrays and index
>}
>} I'm using
>}
>} print -C 1 $filessubject
>
>I was sort of puzzled by why that was suggested. "print -l" (that's a
>lowercase L, not a one) has the same effect, and works in a lot more
>versions of zsh (the -C option is a very recent addition).
>
>} I know want to precede each array entry with it's index number 1,2,3, etc
>}
>} how do?
>
>The most obvious way is:
>
> print -l $filessubject | cat -n
>
>But something like this works too:
>
> i=0 eval print -l '$((++i))\ '${(q)^filessubject}
>
>If you use 'setopt ksharrays' then change that to $((i++)).
Thx JWTDO
--
zzapper
vim -c ":%s%s*%Cyrnfr)fcbafbe[Oenz(Zbbyranne%|:%s)[[()])-)Ig|norm Vg?"
http://www.rayninfo.co.uk/tips/ vim, zsh & success tips
Messages sorted by:
Reverse Date,
Date,
Thread,
Author