From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29549 invoked by alias); 14 Jul 2017 08:58:49 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 41428 Received: (qmail 5876 invoked from network); 14 Jul 2017 08:58:49 -0000 X-Qmail-Scanner-Diagnostics: from mailout2.w1.samsung.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(210.118.77.12):SA:0(-5.0/5.0):. Processed in 1.524627 secs); 14 Jul 2017 08:58:49 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-5.0 required=5.0 tests=RCVD_IN_DNSWL_HI, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.1 X-Envelope-From: p.stephenson@samsung.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at _spf.samsung.com designates 210.118.77.12 as permitted sender) X-AuditID: cbfec7f1-f796e6d00000116b-ce-596885643017 Date: Fri, 14 Jul 2017 09:48:31 +0100 From: Peter Stephenson To: "zsh-workers@zsh.org" Subject: Re: Array expansion interacts with brace expansion in the wrong order Message-id: <20170714094831.576c3d79@pwslap01u.europe.root.pri> In-reply-to: Organization: Samsung Cambridge Solution Centre X-Mailer: Claws Mail 3.7.9 (GTK+ 2.22.0; i386-redhat-linux-gnu) MIME-version: 1.0 Content-type: text/plain; charset=UTF-8 Content-transfer-encoding: quoted-printable X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrDIsWRmVeSWpSXmKPExsWy7djP87oprRmRBhuXKFscbH7I5MDoserg B6YAxigum5TUnMyy1CJ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xPnl/1lAbDYBQ4mpm2Yz gtgiAvoSF//cArOFBfwkfp68zwpi8wrYS9w6ep4dxOYU8JBYfectC8TQBUwSCx//BWvgB2q+ +vcTE8R99hIzr5xhhGgWlPgx+R7YMmYBdYlJ8xYxQ9jaEk/eXWCFuFRd4sbd3ewTGIVnIWmZ haRlFpKWBYzMqxhFUkuLc9Nzi430ihNzi0vz0vWS83M3MQLjaNuxn1t2MHa9Cz7EKMDBqMTD +2NieqQQa2JZcWXuIUYJDmYlEV6nhoxIId6UxMqq1KL8+KLSnNTiQ4ymwJCZyCwlmpwPjPG8 knhDE0NzS0MjYwsLcyMjJXHeqR+uhAsJpCeWpGanphakFsH0MXFwSjUwzpuweOuTZgP+Nw8P vWKZUCUTuNz65h+5SVX+Tgd/vjHOT/GdmPylxspqpvDJU7M7KjUK1HdnyqVePpVeuigu4KXU 08S22x4HFdf+tZ9wcE3xqnTV9lL/1cfqaj2mTf8892kAq7yQR6V4ap4N06u5197dnzrxRq+d iSrrSZ/7ztKrJh/Z8e1ghhJLcUaioRZzUXEiAPDlan25AgAA X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20170714084836eucas1p2c1eebaa260b9dca38bf8a4973fb8efdf X-Msg-Generator: CA X-Sender-IP: 182.198.249.180 X-Local-Sender: =?UTF-8?B?UGV0ZXIgU3RlcGhlbnNvbhtTQ1NDLURhdGEgUGxhbmUb?= =?UTF-8?B?7IK87ISx7KCE7J6QG1ByaW5jaXBhbCBFbmdpbmVlciwgU29mdHdhcmU=?= X-Global-Sender: =?UTF-8?B?UGV0ZXIgU3RlcGhlbnNvbhtTQ1NDLURhdGEgUGxhbmUbU2Ft?= =?UTF-8?B?c3VuZyBFbGVjdHJvbmljcxtQcmluY2lwYWwgRW5naW5lZXIsIFNvZnR3YXJl?= X-Sender-Code: =?UTF-8?B?QzEwG0VIURtDMTBDRDA1Q0QwNTAwNTg=?= CMS-TYPE: 201P X-HopCount: 7 X-CMS-RootMailID: 20170714014844epcas4p2d24ea25d43338e3fa7097e5bb01d3fac X-RootMTR: 20170714014844epcas4p2d24ea25d43338e3fa7097e5bb01d3fac References: On Thu, 13 Jul 2017 21:42:50 -0400 Anders Kaseorg wrote: > The documentation for ${^spec} says >=20 > =E2=80=9CInternally, each such expansion is converted into the equivalent= list for=20 > brace expansion. E.g., ${^var} becomes {$var[1],$var[2],...}, and is=20 > processed as described in Brace Expansion below.=E2=80=9D >=20 > That would seem to support my expectation that {$^a,4,5,6} should become= =20 > {{1,2,3},4,5,6}, which expands to 1 2 3 4 5 6. What it means is the effect similar to brace expansion is *performed* immediately, not simply recorded as happening below with the other brace expansion. So by the time the shell even looks to see if there's any (actual) brace expansion to do, the array has already been expended using its own similar rules and the shell is looking at: {1,4,5,6} {2,4,5,6] {3,4,5,6} There's no likelihood of the big rewrite that would be necessary to transform the array expansion into such a form that it actually happens with the brace expansion; indeed the brace expansion code is quite ad hoc, as I rediscovered only yesterday. The ordering of diferent sorts of expansion in the shell is always a big source of confusion and in head scratching about how to get things to work, but the key is to think of array expansion and brace expansion as completely separate stages. I can't think of an easy workaround for your case except by constructing an array b=3D($a 4 5 6) which is obviously rather more verbose. pws