Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Expand array into multiple elements per item?
- X-seq: zsh-users 16369
- From: Oliver Kiddle <okiddle@xxxxxxxxxxx>
- To: Zsh Users <zsh-users@xxxxxxx>
- Subject: Re: Expand array into multiple elements per item?
- Date: Thu, 15 Sep 2011 20:07:09 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.co.uk; s=s1024; t=1316110030; bh=SCXxWz9Q0trn0gLn8krKk2I1pkeZbILbQNnq2DyeHsE=; h=X-Yahoo-Newman-Id:X-Yahoo-Newman-Property:X-YMail-OSG:X-Yahoo-SMTP:Received:Received:In-reply-to:From:References:To:Subject:Date:Message-ID; b=RfWtWrw8/sAkXD2GfG0de4pwmjs+ax34GUFZoGhDWEnSwy/msptvr6ptvFW/Wdj0MRST6raUC4dhZrCDO//CfWcCGIKsT8iPaeBxitO6YRV68+wWZ4L/JPoKnjR5e3fq92vl5jkiwv5Cl9wiyaItWci3rKpFkqoCL8izSuYBzes=
- In-reply-to: <alpine.LNX.2.01.1109130444170.10525@hp.internal>
- 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
- References: <alpine.LNX.2.01.1109130337270.10525@hp.internal> <20110913083641.GD4542@layslair.ath.cx> <alpine.LNX.2.01.1109130444170.10525@hp.internal>
On 13 Sep, "Benjamin R. Haskell" wrote:
> > You can try this :
> > print -l -- "-id "$^somelist
>
> 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:
If you join the list up and then re-split it, it might work:
print -l -- ${(0)${(pj:\0:):--id$'\0'$a}}
Oliver
Messages sorted by:
Reverse Date,
Date,
Thread,
Author