Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Expand array into multiple elements per item?
- X-seq: zsh-users 16333
 
- From: "Benjamin R. Haskell" <zsh@xxxxxxxxxx>
 
- To: Zsh Users <zsh-users@xxxxxxx>
 
- Subject: Expand array into multiple elements per item?
 
- Date: Tue, 13 Sep 2011 04:15:50 -0400 (EDT)
 
- List-help: <mailto:zsh-users-help@zsh.org>
 
- List-id: Zsh Users List <zsh-users.zsh.org>
 
- List-post: <mailto:zsh-users@zsh.org>
 
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
 
Three questions:
1. How can I easily take:
    somelist=( 'a b' c 'd e' )
and get back:
    anotherlist=( -id 'a b' -id c -id 'd e' )
2. ...relatedly, I'm confused by the following:
     $ somelist=( 'a b' c 'd e' )
     $ print -l - $somelist
     a b
     c
     d e
(i)  $ print -l - $^somelist(e:'reply=( -id $REPLY )':)
     zsh: no matches found: a b(e:reply=( -id $REPLY ):)
(ii) $ print -l - $^somelist(Ne:'reply=( -id $REPLY )':)
     (...nothing printed...)
     $
Why does neither (i) nor (ii) work?
3. I thought I recalled a relatively recent addition to parameter 
expansion flags for just this use-case.  But I can't seem to find the 
flag in zsh-4.3.12 patchlevel 1.5346.  Still interested in the answer to 
the rest, regardless.
--
Best,
Ben
Messages sorted by:
Reverse Date,
Date,
Thread,
Author