From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, MAILING_LIST_MULTI,NICE_REPLY_A,RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 13509 invoked from network); 17 Nov 2022 16:03:05 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 17 Nov 2022 16:03:05 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1668700985; b=D1wD5ZYP2EmrDI5Dus8DoTW+yR1gSkqXuUA08DQ7D1pKDdMsdM1CdGO0F0KfVguj0BsxAAUm7r v/xMvGCuFKw3zcoNaMRsKpoO3m5kk16nlkPpgWCsidbLHE5Ui65CrZeMu2tEY2ScBoOPmzxSWs ad6fIysJYEj7aIatuKdufvK4bFBy4IqUwhLm+J0E9+1PJbQgdsGod73GqlOGVtHna00pKjIMw2 sD0HJPno/PuuP1DswTrIrLIDSa58wf+UfEQGh4ZYeKQyp+ubo5HD0g5qXx8TjdoXIzxty+IF/K GwCnjl2mNPOjJLh77vvtAszbz1L+4TIk752EopWQqvcU1A==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mta02.eastlink.ca) smtp.remote-ip=24.224.136.13; dmarc=none header.from=eastlink.ca; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1668700985; bh=CHdxF4Ta2YURZraTmiwqbXdb7YBd5lblt4Mji7pKzZo=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Transfer-Encoding:Content-Type:In-Reply-To:From: References:To:Subject:MIME-Version:Date:Message-ID:DKIM-Signature; b=VKkUDdeaUQ2exOm9A91JvLkZvw6OPyhvUu7qLOrh23S+NLPpiExrYIewryHsb21qgVURuIIJYi CLairicHqvO3JrC2YkHQYi2UFn5LIYF6vYc5Wa02lEG89GGf7Pf3kJF78UirPqXxzXkVnJU2Zp qi5k0bzwWIw07nW3B1hINLv14AMCiKCzkWPIxbw22lzIz+8UR7Q8odGdV6Wt3vBA8HLWZwx2QI pAve8SCVFhS3aB3lqbVmyspiUrmEt+7W+Q8naUylnRW0G8Shlzo2zbPElS5G7RdsujmYdlf5qg rNEmsFbms1v5wrN9tIgBggfaDF/d+yiBiTgFJ5jNgDmMYw==; 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-transfer-encoding: Content-type:In-reply-to:From:References:To:Subject:MIME-version:Date: Message-id:Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From :Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=sjyty0HLHTan8YA7vEFxpX7lfso3z/kCcEVPJxlh+zU=; b=jij26J1flD+OPbiBVTgX1zwni+ kYmfyc7eMhGwIyEgQgmuyAOLsmW1b6WqcqJE/ThBIuC/XRlZvcHBqtWPC6ItIVU3FQrXbFmN0KsoI xJJCxfbWTFj4XLx5K22i/4mgZO2PSnMzIfAM8VTMrxvhio+idZ7y3H07MoDJMsZ/6az5LPuEDo4yr IOoySocJJ2EfIc4rLfIRF5J03X8Na28BsUL2JRsCBV6mSe+WPkAocvpXithysILmiLG2lr5n3J29G hntV+xofxRcb+9u6T7oxNwOtYCD3VPym6WJHl1oHSjofBppk9cR1w5UD73kGjbr1fkEZIKXvoILOJ cBsdW+4A==; Received: by zero.zsh.org with local id 1ovhM0-000IsF-DY; Thu, 17 Nov 2022 16:03:04 +0000 Authentication-Results: zsh.org; iprev=pass (mta02.eastlink.ca) smtp.remote-ip=24.224.136.13; dmarc=none header.from=eastlink.ca; arc=none Received: from mta02.eastlink.ca ([24.224.136.13]:56058) by zero.zsh.org with esmtps (TLS1.2:ECDHE-RSA-AES128-GCM-SHA256:128) id 1ovhLC-000IBc-BE; Thu, 17 Nov 2022 16:02:14 +0000 Received: from csp01.eastlink.ca ([71.7.199.166]) by mta02.eastlink.ca (Oracle Communications Messaging Server 8.0.2.2.20180531 64bit (built May 31 2018)) with ESMTPS id <0RLI00GQ4199TR20@mta02.eastlink.ca> for zsh-users@zsh.org; Thu, 17 Nov 2022 12:02:11 -0400 (AST) Received: from [192.168.0.4] ([24.207.18.108]) by Eastlink with ESMTPSA id vhL9oGoDYkffJvhL9ow7Bo; Thu, 17 Nov 2022 12:02:11 -0400 X-Authority-Analysis: v=2.4 cv=Lbf6qBTi c=1 sm=1 tr=0 ts=63765b03 a=xN66ZtSbq5jdJYpBp7G/jQ==:117 a=xN66ZtSbq5jdJYpBp7G/jQ==:17 a=IkcTkHD0fZMA:10 a=60-y8Mk9yYGWvT5mWHoA:9 a=QEXdDO2ut3YA:10 X-Vade-Cause: gggruggvucftvghtrhhoucdtuddrgedvgedrgeekgdekvdcutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfgtefuvffnkffpmfdpqfgfvfenuceurghilhhouhhtmecufedttdenucenucfjughrpefkffggfgfuvfhfhfgjtgfgsehtkeertddtfeejnecuhfhrohhmpeftrgihucetnhgurhgvfihsuceorhgrhigrnhgurhgvfihssegvrghsthhlihhnkhdrtggrqeenucggtffrrghtthgvrhhnpeeitdejffevgfdtheeggfetkeeugeegieetuddtvddvudetteffvdevlefgueekudenucfkphepvdegrddvtdejrddukedruddtkeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpedvgedrvddtjedrudekrddutdekpdhhvghloheplgduledvrdduieekrddtrdegngdpmhgrihhlfhhrohhmpehrrgihrghnughrvgifshesvggrshhtlhhinhhkrdgtrgdpnhgspghrtghpthhtohepvddprhgtphhtthhopeerredprhgtphhtthhopeiishhhqdhushgvrhhsseiishhhrdhorhhgpdhgvghtqdgkihhprfgrshhsfigupehtrhhuvg X-Vade-Score: 0 X-Vade-State: 0 X-EL-AUTH: rayandrews@eastlink.ca Message-id: <33451f56-953e-a4a5-ddb1-3fb74fa505bc@eastlink.ca> Date: Thu, 17 Nov 2022 08:02:10 -0800 MIME-version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.0 Subject: Re: Belaboring substitution syntax To: zsh-users@zsh.org References: <3a10f310-3ee8-d3b4-f6db-7fdb18b81b1f@eastlink.ca> <77692192-70b3-8a6a-fd01-d5f8b37f59b2@eastlink.ca> <879a8fb0-74b7-5250-d2ff-2f60585f48a4@eastlink.ca> <0ce205d5-31f9-907a-61bd-1bf5acb37f0f@eastlink.ca> <1d79745a-10fd-3a23-c67f-af1048be6b19@eastlink.ca> Content-language: en-US From: Ray Andrews In-reply-to: Content-type: text/plain; charset=UTF-8; format=flowed Content-transfer-encoding: 8bit X-Seq: 28408 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 2022-11-17 00:59, Roman Perepelitsa wrote: > ... > And these four are equivalent: > > ${array[@]} > ${(@)array} > ${array} > $array > > Roman. Thanks, that's what I call quality explanation, I'm going to save that whole post to my cheat sheet and work it over at length.  2/3 of my own difficulties here involve all this splitting/joining stuff. Mostly because I use Sebastian's n_list() quite a bit and it demands lines/elements for input, with blank lines and spaces in filenames protected.  The construction that seems robust is like this: n_list "${array[@]}" ... for the reasons you mention.  A useful document would be the Unabridged Guide to Zsh Arrays (their splitting, splicing, slicing and dicing, with protections and without, with all flags explained and specimens of every possible syntax and when you'd want to use them). I know it's far too late in the game to even think about fundamental changes, but if we had to do it all over again I'd advocate for a single universal expansion grammar: ${(CONTROL) FIELD  /  FIELD / FIELD } No '//' '##' '%%' or any of that.  '/' is the universal separator, and what is done to the fields is entirely explained within the parenthesis.  No more worries about special characters except '/' and maybe " " and ' ' and backslash cuz those expansion controls are robust.  Within the parenthesis there are zero worries about literals, it's 100% operators so the syntax-space is unlimited.  Within the fields there are zero operators (except quote expansions) so parsing becomes vastly simpler. ${(S:a!$%&@N/(xx^)**/*<>) ${array} / ${filter} } ... what's in the () explains exactly what is to be done vis a vis the two fields ... or more. ${(VERBS) NOUNS / NOUNS / NOUNS } ${(PREDICATES) SUBJECTS } ... that's the way a grammar should look.  Basically 'flags' do everything and verbs and nouns are never intermingled.  That's the reason glob qualifiers are so stinking powerful, cuz within the parenthesis their is nothing one might not achieve. Nevermind.  :-)