Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: use 'P' parameter expansion flag with array?
- X-seq: zsh-workers 27075
- From: Mikael Magnusson <mikachu@xxxxxxxxx>
- To: zsh-workers@xxxxxxxxxx
- Subject: Re: use 'P' parameter expansion flag with array?
- Date: Tue, 30 Jun 2009 17:19:44 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=mKsf3eG7wDuD/MWavp9Wm8jH+ebgBwUxVkS30pjYny0=; b=t3tNxod7FHBNi39y0O0h0pwLl51BUH775sbhGVcpGxS0tcgpKlL58vaTA+SyTkD4yH lNGHPv0fqALQk6CaoJbLWJcDrKyIGhKeM3HULeCx+bT1yuJzi69abmFPuddKsp0stBfJ BNQW8cfsVZby7K2Xgs9i3O51ntozuDIThcgOY=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=O4EzeGDpI/zKmaIqBDGHZuufBXsFlWrv9Mk/awEMLE/mYu6fNIN/hunsSO1YV0dRIL yfZj4wWVKuMMlScxqJnLvoYQls+x3kwIaGmHNRIx7iyo+QiFz4ne373M8sDdORxPlOTZ 4ciT3qR2yMDvphQkcTYQ1q2HJdwmAM2BHGTi0=
- In-reply-to: <m363edn4in.fsf@xxxxxxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- References: <19017.33909.493608.356003@xxxxxxxxxxxxxxxxxx> <200906300843.n5U8hecG011236@xxxxxxxxxxxxxx> <m363edn4in.fsf@xxxxxxxxxxxxxx>
2009/6/30 Greg Klanderman <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.
echo ${(j.:.):-${(@)^a}foo}
will work fine, the simplest case of the error is this, i think:
% echo ${${}foo}
zsh: bad substitution
% echo ${:-${}foo}
foo
--
Mikael Magnusson
Messages sorted by:
Reverse Date,
Date,
Thread,
Author