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

Re: use 'P' parameter expansion flag with array?



> 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