Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: printing arrays and index
- X-seq: zsh-users 9130
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: printing arrays and index
- Date: Sat, 23 Jul 2005 04:59:15 +0000
- In-reply-to: <gcd2e1pr6d3s08cad77b1f6j3j11d2dgpd@xxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <gcd2e1pr6d3s08cad77b1f6j3j11d2dgpd@xxxxxxx>
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++)).
Messages sorted by:
Reverse Date,
Date,
Thread,
Author