zsh-workers
 help / color / mirror / code / Atom feed
From: Greg Klanderman <gak@klanderman.net>
To: zsh-workers@sunsite.dk
Subject: Re: use 'P' parameter expansion flag with array?
Date: Tue, 30 Jun 2009 11:08:16 -0400	[thread overview]
Message-ID: <m363edn4in.fsf@klanderman.net> (raw)
In-Reply-To: <200906300843.n5U8hecG011236@news01.csr.com> (Peter Stephenson's message of "Tue, 30 Jun 2009 09:43:40 +0100")


> 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


  reply	other threads:[~2009-06-30 15:08 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-30  3:20 Greg Klanderman
2009-06-30  8:43 ` Peter Stephenson
2009-06-30 15:08   ` Greg Klanderman [this message]
2009-06-30 15:19     ` Mikael Magnusson
2009-06-30 15:51       ` Greg Klanderman
2009-07-05 19:56   ` Bart Schaefer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m363edn4in.fsf@klanderman.net \
    --to=gak@klanderman.net \
    --cc=zsh-workers@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).