Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: use 'P' parameter expansion flag with array?
- X-seq: zsh-workers 27074
- From: Greg Klanderman <gak@xxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxx
- Subject: Re: use 'P' parameter expansion flag with array?
- Date: Tue, 30 Jun 2009 11:08:16 -0400
- In-reply-to: <200906300843.n5U8hecG011236@xxxxxxxxxxxxxx> (Peter Stephenson's message of "Tue, 30 Jun 2009 09:43:40 +0100")
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- References: <19017.33909.493608.356003@xxxxxxxxxxxxxxxxxx> <200906300843.n5U8hecG011236@xxxxxxxxxxxxxx>
- Reply-to: gak@xxxxxxxxxxxxxx
> It does seem logical, but the code is obscure and it's not clear whether
> this was intended or not---it probably fell through the cracks.
Thank you Peter, I'll just use a loop then..
> paramsubst() is full of my "one day someone should spend a year tidying
> this up" comments.
Yeah I enjoyed reading a number of those last night after sending
that question :-)
So if I have an array and want to append a string to each of the
elements, then join with colon, is there a better way than this:
lwm% a=(x y z)
lwm% echo ${(j.:.)${(@)a/%/foo}}
xfoo:yfoo:zfoo
I was trying to do something using '^' but it doesn't seem to work;
lwm% echo ${(@)^a}foo
xfoo yfoo zfoo
does what I expect, but:
lwm% echo ${(j.:.)${(@)^a}foo}
zsh: bad substitution
does not.
thanks,
Greg
Messages sorted by:
Reverse Date,
Date,
Thread,
Author