From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24012 invoked by alias); 19 Dec 2016 15:02:50 -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: 22240 Received: (qmail 21700 invoked from network); 19 Dec 2016 15:02:50 -0000 X-Qmail-Scanner-Diagnostics: from mail-ua0-f175.google.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(209.85.217.175):SA:0(0.0/5.0):. Processed in 2.005949 secs); 19 Dec 2016 15:02:50 -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=0.0 required=5.0 tests=FREEMAIL_FROM,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_PASS,T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.1 X-Envelope-From: plalloni@gmail.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at _netblocks.google.com designates 209.85.217.175 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=E6IvPcFYHy9PriQqmpj3tGoIlsiuI7J3jyPBp5FreHI=; b=q7jlBYur+t9PVIPdRcF3f9zmizdit+JqjVDB2+Z2X+YubxbV6rZwxDdnvxs3sLyt8W NrgT7UAaQESRqdgINxiQTkwdRF2zWIuKBrYugrq8pCy2BaPXoZri9OhZiSG9I8sc700m ZUHfEhrffiZML5+Nn2NhZN+ONag+mU1w5x3N5TiVzYGesXsm+UVfI3edw7n+LpkeNOpL xGngtT3vYLJXx6Q5tQeAm9yOL0z8nRnRD/VnyMIIEQnzTLDIK7ket+7c7XbVFae2xWaO R6E06x8f9o+0Vh3/1W3f2WC8ujNS54GzK0h58APHpAAKTK8UzUgBK9+0IhSoEq0f3Ir+ irKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=E6IvPcFYHy9PriQqmpj3tGoIlsiuI7J3jyPBp5FreHI=; b=SoIz/0bVbj3Dx6W6NpC5MLieC8q2l+D0/MPReYVW5lgS4qGuOUP31yZb7NwOtgiyIe y1IxN3F5FGRfx4Q7jMeprPZ0lyf2h+2YljpVOZs0945lJbUI0MMVTzB4mndDfLQFDrJN BiASWaghmRCeodDO2wVIiw0fkxJuQPwes4bXYPnEwdlt6HCUES+KkKHvl2EpRll11hQQ yT93GzRHlKUeSIix0dJNEjrXI5ruE6h6+SV21GDm5aiI/UpQJvY5P9NIuHEhFCQwSwcW 47URXDMlQE21YhMPlWP681mv8+i/RK+EREUYcdTL1eM58fK+YS2O8iV4k9kCbNa8ktJg WLyg== X-Gm-Message-State: AIkVDXKEWFN6d6NNnpxuR4VhgJfFvuSy/vjwEu8yvJ/h7tbC7eXnq8fVZVw5UWegk82mkYKcfyz3tQBLWqeqPA== X-Received: by 10.176.16.30 with SMTP id f30mr13109742uab.58.1482159761111; Mon, 19 Dec 2016 07:02:41 -0800 (PST) MIME-Version: 1.0 In-Reply-To: <161218180807.ZM5238@torch.brasslantern.com> References: <161218180807.ZM5238@torch.brasslantern.com> From: Pablo Lalloni Date: Mon, 19 Dec 2016 12:02:00 -0300 Message-ID: Subject: Re: Apparent inconsistency in f/z expansion flags behavior To: zsh-users@zsh.org Content-Type: multipart/alternative; boundary=f403045e21e00fbe980544043645 --f403045e21e00fbe980544043645 Content-Type: text/plain; charset=UTF-8 Thanks for your responses guys. Both variations works as you said. Better yet, I understand why. Cheers! On Sun, Dec 18, 2016 at 11:08 PM, Bart Schaefer wrote: > On Dec 18, 8:02pm, Pablo Lalloni wrote: > } > } words=(${(z)$( } > } Which set words with the array of all the words in the file and that's > } great. > } > } lines=(${(f)$( } > } But then I get an array with just one string containing all the lines > } concatenated (no NLs). > > That's happening because $( spaces before (z) or (f) begin working. (z) doesn't care because it > splits on shell-syntax whitespace, but (f) has nothing to split on. > > To get what you want, you have to quote the $(...) substitution so the > NLs are preserved: > > lines=(${(f)"$( > That would be "more correct" in the (z) use as well, just in case the > line breaks were e.g. inside quoted strings that would change the shell > parse. (Not an issue with /proc/meminfo, of course, but in general.) > > } Note that if you split the last assignment in 2 steps, it works as > expected: > } > } lines=$( } lines=(${(f)lines}) > > There you've done first an assignment to a scalar, which preserves the > NLs as if $(...) were quoted. > --f403045e21e00fbe980544043645--