From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI autolearn=ham autolearn_force=no version=3.4.4 Received: from zero.zsh.org (zero.zsh.org [IPv6:2a02:898:31:0:48:4558:7a:7368]) by inbox.vuxu.org (Postfix) with ESMTP id AD74B22114 for ; Sun, 5 May 2024 21:46:40 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20210803; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:Content-Type:Subject:To:From:Date: References:In-Reply-To:Message-Id:MIME-Version:Reply-To:Cc: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=raqERxJKu0kRF9eutNFJENZyHnTEjnuWzN4gZZW2q9w=; b=mlrQyxpd/uBzKkzJHtKGHQ776P ikzs/i8WT+ai4fq0upOF1if4+7hdsHwLIvvDpFo5qhEMYKcSjKle2QQnhOFmjJT8Mt02y6OE9D1Sf 8P9/h3Ik6ikVxu/V1VVb/BJ+eG8xtP0RXbryJCt8YgjNy7cUqvfROqUPzCsy7I8MIvl0AzzPdti8A PgQyFz8miLIUVxAZ1917UE0yWy/7LWhLNl7VnWhkk/igult8H+5HaMEEnKAQTfNDPBYiE82rpY8WR P4RFSzROsMo9JcHz0ZWg2Ff3eQJXSD7Ghp4Aro3nStw5t0xAvPrXp325kKnJU6Zu/Dj6ziin0QA+u cT9ZSH3A==; Received: by zero.zsh.org with local id 1s3hol-0006KI-Eg; Sun, 05 May 2024 19:46:39 +0000 Received: by zero.zsh.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1s3hnG-0005Mr-Ds; Sun, 05 May 2024 19:45:06 +0000 Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailfauth.nyi.internal (Postfix) with ESMTP id 1C54E1200032 for ; Sun, 5 May 2024 15:45:04 -0400 (EDT) Received: from imap48 ([10.202.2.98]) by compute2.internal (MEProxy); Sun, 05 May 2024 15:45:04 -0400 X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrvddvgedgudeggecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecunecujfgurhepofgfggfkjghffffhvffutgesth dtredtreerjeenucfhrhhomhepnfgrfihrvghntggvucggvghljoiiqhhuvgiiuceolhgr rhhrhihvseiishhhrdhorhhgqeenucggtffrrghtthgvrhhnpeeileevheefgffhffeihe dtieegvdfgkeffteejgfetledtiedviedvteeukeegkeenucevlhhushhtvghrufhiiigv pedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehlrghrrhihvhdomhgvshhmthhprghuth hhphgvrhhsohhnrghlihhthidqudduhedukeejjedtgedqudduledvjeefkeehqdhlrghr rhihvheppeiishhhrdhorhhgsehfrghsthhmrghilhdrtghomh X-ME-Proxy: Feedback-ID: iaa214773:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id C8B8231A0065; Sun, 5 May 2024 15:45:03 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.11.0-alpha0-417-gddc99d37d-fm-hotfix-20240424.001-g2c179674 MIME-Version: 1.0 Message-Id: <9a82e3a2-0bf1-4563-b5ae-c40d9ef659c9@app.fastmail.com> In-Reply-To: References: Date: Sun, 05 May 2024 15:44:35 -0400 From: =?UTF-8?Q?Lawrence_Vel=C3=A1zquez?= To: zsh-users@zsh.org Subject: Re: nesting issue Content-Type: text/plain X-Seq: 29898 Archived-At: X-Loop: zsh-users@zsh.org Errors-To: zsh-users-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-users-request@zsh.org X-no-archive: yes List-Id: List-Help: , List-Subscribe: , List-Unsubscribe: , List-Post: List-Owner: List-Archive: On Sun, May 5, 2024, at 9:13 AM, Ray Andrews wrote: > On 2024-05-04 20:20, Bart Schaefer wrote: >> They give "bad substitution" because you can't have a space before the >> closing "}" / after the closing ")" in the parameter expansion. >> >> local sorted=( "${(f)$(print -l "${(n)in[@]}")}" ) >> > Nuts, I wouldn't have even considered that. > > Even tho it is accepted here?: > > sorted=( "${(f)sorted}" ) You're not comparing the right spaces. The problem Bart pointed out is more akin to sorted=( "${(f)sorted }" ) > One thing tho, since nested quotes end up un-quoting the inner > quotation (or is this an exception?) Command substitution introduces a new quoting context. Things like "$(cmd "arg with spaces")" work fine. > I'm thinking that: > > local sorted=( "${(f)$(print -l ${(n)in[@]})}" ) > > ... one set of quotes -- should be fine. And it seems fine. Unquoted ${(n)in[@]} drops empty elements and is equivalent to unquoted ${(n)in}. Whether that's acceptable is dependent on application requirements, as always. -- vq