From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15559 invoked by alias); 7 Sep 2012 15:43:44 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 17231 Received: (qmail 22393 invoked from network); 7 Sep 2012 15:43:33 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham version=3.3.2 Received-SPF: none (ns1.primenet.com.au: domain at biskalar.de does not designate permitted sender hosts) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Apple Message framework v1278) Subject: Re: double quoted expansion question From: Sebastian Stark In-Reply-To: <29236168-55B5-4555-9ACA-B1D21D345EA9@biskalar.de> Date: Fri, 7 Sep 2012 17:43:19 +0200 Content-Transfer-Encoding: quoted-printable Message-Id: References: <29236168-55B5-4555-9ACA-B1D21D345EA9@biskalar.de> To: zsh-users@zsh.org X-Mailer: Apple Mail (2.1278) Am 07.09.2012 um 16:41 schrieb Bart Schaefer: > On Sep 7, 2:31pm, Sebastian Stark wrote: > } > } Dear zsh users, > }=20 > } What I would like to understand here is why the output changes the = way > } it does when I add double quotes around my expression. I would = expect > } the same output as without. If anybody could shed some light please, = I > } guess it's just something obvious I cannot see. >=20 > It may help to read the "Rules" subsection in the "Parameter = Expansion" > section of the zsh manual. >=20 > Note that "double quoted joining" happens at step 5, before = "modifiers" > [including the //* / replacement] at step 7. Although "forced = splitting" > (the s and f flags) doesn't happen until step 16, "nested = substitution" > happens at step 1, so your innermost ${(f)servers} still happens = before > double quoted joining is done, and it's the result of that split that = is > then joined on spaces, causing //* / to do something you don't expect. >=20 > So what you need to do is tell zsh not to join that array, which you = do > by adding the @ flag at the nesting level where the join would happen: >=20 > print "${(s:,:uo)${(j:,:)${(@)${(f)servers}//* /}}}" Wow, thanks. My mistake is that I thought that because the quotes are at = the outermost level, the double quoted joining was not part of this and = applied at the very end. This explains why my assumption was wrong for = that case. For here-docs there seems to be yet another twist: =E2=9D=AF cat < Sebastian