From: "Benjamin R. Haskell" <zsh@benizi.com>
To: Anthony Charles <antho.charles@gmail.com>
Cc: Zsh Users <zsh-users@zsh.org>
Subject: Re: Expand array into multiple elements per item?
Date: Tue, 13 Sep 2011 04:52:11 -0400 (EDT) [thread overview]
Message-ID: <alpine.LNX.2.01.1109130444170.10525@hp.internal> (raw)
In-Reply-To: <20110913083641.GD4542@layslair.ath.cx>
On Tue, 13 Sep 2011, Anthony Charles wrote:
> Hi,
>
> You can try this :
> print -l -- "-id "$^somelist
>
> anotherlist=( "-id "$^somelist )
>
> But I can't give you any answer for question 2 :/
anotherlist should end up as I specified before:
$ anotherlist=( -id 'a b' -id c -id 'd e' )
I.e. separate elements, but not just word-splitting everything:
$ print -l - $^anotherlist
-id <-- separate
a b <-- kept as one argument
-id <-- separate
c
-id <-- separate
d e <-- kept as one argument
With your suggestions the -id isn't a separate element:
$ print -l - "-id "$^somelist
-id a b
-id c
-id d e
$ anotherlist=( "-id "$^somelist )
$ print -l - $^anotherlist
-id a b
-id c
-id d e
--
Best,
Ben
next prev parent reply other threads:[~2011-09-13 8:52 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-13 8:15 Benjamin R. Haskell
2011-09-13 8:36 ` Anthony Charles
2011-09-13 8:52 ` Benjamin R. Haskell [this message]
2011-09-15 18:07 ` Oliver Kiddle
2011-09-13 8:57 ` Peter Stephenson
2011-09-13 10:19 ` Mikael Magnusson
2011-09-13 17:32 ` Benjamin R. Haskell
2011-09-13 17:21 ` Benjamin R. Haskell
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=alpine.LNX.2.01.1109130444170.10525@hp.internal \
--to=zsh@benizi.com \
--cc=antho.charles@gmail.com \
--cc=zsh-users@zsh.org \
/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).