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,RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 16056 invoked from network); 15 Nov 2022 14:18:48 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 15 Nov 2022 14:18:48 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1668521928; b=sjTWuZvSKKromQCnkry5OVGeP4WJFWtK7BCbj345QIvUfgfGbnCTpGLvmPeGJtlHvD9JVtbwgq 1D0/BD9m4KWZ41Z7umn3LK2RRG8KbAKPveLGNKbx6c3sXCUzOK6EvC8pbZ1PvfObWy3kNKASeE TUFwZ/BC9gUTpSdK2f9VgFDRwlYcPdqcfZ1JtuT1uC0qibYfvL7AqxW8YHVuSR2JpScXH6kqjm hfUH/IN6pymd0HUJWWC8iAQrOVd523Z5WBGrTIfy0BFv7Qj8k0GEwTnW8E87f9tTNoRVjyjZgs arPWtqHGrSIdRI9O0dPnS5wGuYhtdrjzxdm3NAYWOJgUyg==; 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=1668521928; bh=cUfwvlqsDEkg2LN5z28gQmIWiZHLqvUDDw7dMq2Jruo=; 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=IDBrm0OdUB758GbWM8T1vaq1AsaUeFQvqcxn7D7IMbFIivSzg1hDYutMKFH6iZARo4NfPz+cHh Y+SVziKHOWl/6emyuGCclxm3ARmfXF7a1REKI4WRzsm8vsS43OWN/cZkKHNnzzzwXZHRa4rtPE hhyloYreOlHUSorqibhXVP9YwEO35Nmbr8B03e2F0lvFcMqtzRnmM3Ojx3HyIroHysHAc/jb+i xm5g57oL0UGt3uekkM4vcCXrvRSifL6IheQuLIyf3F6LUPrZzR0dczc7FdxLjNVPts82Hgsw6v v+MyuO/rEJCGonsiTNrKIsNeSRw9Vod4o6tEFAcOsEaJKw==; 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=BfuX1FrOHk/kZBZphTebH4Tqzc5fgaX4a40Ae/G65vc=; b=WDU4L9qaFJktFXOdYRu+WKTmYb lnyAsubpVjn4mCjhtj/B7GGcnLg0BZVT1aNEeNXR1gYdG97yzXpGxA3IfBm6HM3YP4oYhcEMNKXTJ YH4ZQ8+7XTCSFcTOyf9M9rZt9bWiKohyOwDqfPodzluwLbXHZFxrUuXXmzVy33XfeeF55zlq6l/vQ DVkQWFNrovJuYrinduaKgYf/3Sz91dk6KGzdZroOYfnUYz8FxEbHjuRRpGARWxmB65SGpj2ylCeO3 Tm0vu9HHgRNSTgVttTbGNcJHj+If/mfEsYR3PgR0fEuqtQA04gXZ4a/sSggMjDhO9kfRDtGYiYjwb MhiG9+3A==; Received: by zero.zsh.org with local id 1ouwlz-000Igx-WB; Tue, 15 Nov 2022 14:18:48 +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]:33286) by zero.zsh.org with esmtps (TLS1.2:ECDHE-RSA-AES128-GCM-SHA256:128) id 1ouwl8-000Hzv-O7; Tue, 15 Nov 2022 14:17:55 +0000 Received: from csp02.eastlink.ca ([71.7.199.167]) by mta02.eastlink.ca (Oracle Communications Messaging Server 8.0.2.2.20180531 64bit (built May 31 2018)) with ESMTPS id <0RLE00LGA3GBZ500@mta02.eastlink.ca> for zsh-users@zsh.org; Tue, 15 Nov 2022 10:17:53 -0400 (AST) Received: from [192.168.0.4] ([24.207.18.108]) by Eastlink with ESMTPSA id uwl6oHNocgfyjuwl7of2lB; Tue, 15 Nov 2022 10:17:53 -0400 X-Authority-Analysis: v=2.4 cv=M9uLaQ8s c=1 sm=1 tr=0 ts=63739f91 a=xN66ZtSbq5jdJYpBp7G/jQ==:117 a=xN66ZtSbq5jdJYpBp7G/jQ==:17 a=IkcTkHD0fZMA:10 a=Cvxe21X1o-rRka2XQbYA:9 a=QEXdDO2ut3YA:10 X-Vade-Cause: gggruggvucftvghtrhhoucdtuddrgedvgedrgeeggdeifecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfgtefuvffnkffpmfdpqfgfvfenuceurghilhhouhhtmecufedttdenucenucfjughrpefkffggfgfuvfhfhfgjtgfgsehtjeertddtfeejnecuhfhrohhmpeftrgihucetnhgurhgvfihsuceorhgrhigrnhgurhgvfihssegvrghsthhlihhnkhdrtggrqeenucggtffrrghtthgvrhhnpeeihfefvdffleegjeefjeehjeevfffhffdufeeuudefvefftdetudeihfevveeifeenucfkphepvdegrddvtdejrddukedruddtkeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpedvgedrvddtjedrudekrddutdekpdhhvghloheplgduledvrdduieekrddtrdegngdpmhgrihhlfhhrohhmpehrrgihrghnughrvgifshesvggrshhtlhhinhhkrdgtrgdpnhgspghrtghpthhtohepvddprhgtphhtthhopeerredprhgtphhtthhopeiishhhqdhushgvrhhsseiishhhrdhorhhgpdhgvghtqdgkihhprfgrshhsfigupehtrhhuvg X-Vade-Score: 0 X-Vade-State: 0 X-EL-AUTH: rayandrews@eastlink.ca Message-id: <879a8fb0-74b7-5250-d2ff-2f60585f48a4@eastlink.ca> Date: Tue, 15 Nov 2022 06:17:52 -0800 MIME-version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.0 Subject: Belaboring substitution syntax To: zsh-users@zsh.org References: <6a92000c-dee5-a1e3-a77f-6a4697a66ab1@eastlink.ca> <34a949c4-0853-4c65-d2ad-db40749dff81@eastlink.ca> <2dd50dc8-cdbc-02e0-0e1e-485718732d0d@eastlink.ca> <3a10f310-3ee8-d3b4-f6db-7fdb18b81b1f@eastlink.ca> <77692192-70b3-8a6a-fd01-d5f8b37f59b2@eastlink.ca> Content-language: en-US From: Ray Andrews In-reply-to: Content-type: text/plain; charset=UTF-8; format=flowed Content-transfer-encoding: 7bit X-Seq: 28388 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: Ignore this post unless you're the sort of person who loved grammar in school: cc=( "${cc[@]/#%^*$~zsh_case${filter}*}" ) ... working fine, and approved by Stephane and Roman. But, trying to 'feel' the rightness of it, I sorta get that '[@]' is saying: "process this array line by line" thus preserving array indexes. I'm not sure about the quotes. Quotes seem to mostly combine words into lines -- or should I say that they mostly combine what would be word splitting into bigger elements: array=( "this array" "has" "three elements" ) ... and sometimes the quotes seem to protect stuff from expansion or interpretation: " $ echo "Yar 'en ign'rint fool!" ". In my case, leaving the quotes out doesn't *seem* to matter but I know it would bite me eventually. When would it bite me? And: " /#%^ " ... it seems to me this is belaboring something simple. Do we not have an operator that says (in English): If string A is a substring of B, then return B, else return nothing. No anchors, no negation. Inventing '!!' as my operator (yes I know it won't work but just for discussion): cc=( "${cc[@]!!$~zsh_case${filter}}" ) One operator instead of four. Actually, in such a construction the anchors would say: ... furthermore the substring must start at the beginning of the element: cc=( "${cc[@]!!#$~zsh_case${filter}}" ) ... or must end at the end of the element: cc=( "${cc[@]!!%$~zsh_case${filter}}" ) ... This wouldn't be a fancy substitution so much as a truth test with nulling of 'false'. Dunno, but it seems like a simple thing and one of the first things a shell might be able to do. Instead what we seem to have is a powerful operator that must then be dumbed down. Not important, but if anyone is interested.