Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Array expansion interacts with brace expansion in the wrong order
- X-seq: zsh-workers 41426
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Anders Kaseorg <andersk@xxxxxxx>
- Subject: Re: Array expansion interacts with brace expansion in the wrong order
- Date: Thu, 13 Jul 2017 16:48:45 -0700
- Cc: "zsh-workers@xxxxxxx" <zsh-workers@xxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=FVlbTrY1H61vnsT9kxXhlsWoJ0idpGkSKMAdDZjLuGo=; b=kXG9YlQxoNlrTzPjsF9nmA+PNH/6V4Q5oSBmbm2M+d94faJBq249eYBhfk/gPXBK0I LhbT/ME38qOyuE7SUPvGwtstw6gcnidvxhrR8f14wTXBE0dPR1bwMDglj6t7bYep0pCJ /V42dSYchD27enWeR2S4CoLyBvCe22HtiKEspvIKrIhD0v6VtOUbGrZg/o8QWITsSUVj S3KWK0DRWuZRZiRrIM7R1r9XvJub6U6VpPtmkLmsW45RGT+sbqN54GXZ3aBKKHWnzQFD L23Kk3P7snU0ca995ujwOnhOMR4mgKeKBYuuOqElpBDqLpFY5fQUSEBkhQZGUbGzMMz8 xXyQ==
- In-reply-to: <alpine.DEB.2.10.1707131831290.28302@mass-toolpike.mit.edu>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <alpine.DEB.2.10.1707131831290.28302@mass-toolpike.mit.edu>
On Thu, Jul 13, 2017 at 3:45 PM, Anders Kaseorg <andersk@xxxxxxx> wrote:
> Given a=(1 2 3), I would expect {$^a,4,5,6} to expand to 1 2 3 4 5 6, but
> it doesn’t. Instead the 4 5 6 is duplicated for every element of $^a
Your expectation is wrong. Brace expansion happens last of all
(except for globbing), so {$^a,4,5,6} is {1,4,5,6} {2,4,5,6}
{3,4,5,6}. This is documented.
Even if this happened in the order you expect, the way you've written
it would have given 1 4 1 5 1 6 2 4 2 5 2 6 3 4 3 5 3 6 because of the
meaning of $^a.
What you are after is simply {"$a",4,5,6}.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author