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 30295 invoked from network); 18 Oct 2022 14:47:55 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 18 Oct 2022 14:47:55 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1666104475; b=J44urgxN80Q0JYHewLtO8DltkfswSki+l/3Kp6ERPJ//WQqFjjDMOlYkr3boUzZqdo5JYDgRMx e0gwemGFNUroNsk+X4cfsq5fopV06fUIC8ffaa+9OOLsD8HifEG7G4p4yy+xXgc3xmcXoFD5W7 /JE8MN50QK/dSVzd0Wf8HF2AIp3oHKlh0rfXu/+rYh0AaXw78ZOsN/TUSXBiV986tJOSbFcLWg fW+0Xb+Fw2lQrgWWjjwtCmNP1yQ6IYczC4XvhmjRbvDL+0m1/GUtvZlTa2u8wVZCb+1OP5BMYm qUcvv+uL/ing/baJX4s6QWyR/0CHaFuxK9U5talGEVKMOw==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mta03.eastlink.ca) smtp.remote-ip=24.224.136.9; 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=1666104475; bh=DzUTtkLEdmuDAcfQowZvMcPgYFrHWmp4lOVjcwbbLTk=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Transfer-Encoding:Content-Type:Subject:From:To: MIME-Version:Date:Message-ID:DKIM-Signature; b=XPMGhqPaMf0W6sXqp6jD8jA9/II0ROviFyMjyzgIoTKUAAOmZHqjwFjY/kgdnv2bCYtLMW1tZO FV6LOLN6E3wRSePTOWR+5ZQ9ack8ukJGeFvxWhHYET2p1a6zmCZ8+JCCvm0ozzhvMSPKTbdtwE rJTCkkVdAXwPIIDYEHWPajHe+HQxp78W8VYD0lzOZ+kg+otOF9K0CURnXQdXOUaeheecWDcj9U RTE0PZWKZUC4sj9Sc7pzSOkejJHKkvCXiYCBvVr4hwl1Jmsq3wz5V2n7jivyeEKQuOD8MMi+63 frrlAYo1k4xoyhIq0okO3gyyLdwaTzndfvxkHe4nBVmotA==; 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:Subject:From:To: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:In-Reply-To:References; bh=vUKYYZQ+HB3COGGTR2nTWyqrSlWs45pJ580NR2plJpQ=; b=f6bpc/CzyezxbgFA4B3DwS7T7G +UoHQ5dzKJTxkYkECzJQJq2wuO+SeEl/3Ei2evKvY6aGJE5Xl32ahBlizcz6+QsdLO4ka3/Xj2B+T Q0+s9jSg/HOfBvbyEh6x6e1vzrMSiu0vp8uFPxyuwiQGcuISfNemUxOOF/LqWm8i7KJbRcKAR9KRF FZGUoVXjpPkP0viDO0dPyXsyxoXnevk6PFGsSSi83QQxj52+Hp3RXZyoOVAwkCFxI6/TFa59rA3fY itLPISJr5NDflLCng0756NQKeyQJ754Z0+KoAgYCq9+BHdWLhOoIu8bWM6Uh/EQiWwfqL/EuSdjdU YtW4RteA==; Received: by zero.zsh.org with local id 1oknso-000K8M-Hd; Tue, 18 Oct 2022 14:47:54 +0000 Authentication-Results: zsh.org; iprev=pass (mta03.eastlink.ca) smtp.remote-ip=24.224.136.9; dmarc=none header.from=eastlink.ca; arc=none Received: from mta03.eastlink.ca ([24.224.136.9]:60123) by zero.zsh.org with esmtps (TLS1.2:ECDHE-RSA-AES128-GCM-SHA256:128) id 1okns3-000JU3-6c; Tue, 18 Oct 2022 14:47:07 +0000 Received: from csp01.eastlink.ca ([71.7.199.166]) by mta03.eastlink.ca (Oracle Communications Messaging Server 8.0.2.2.20180531 64bit (built May 31 2018)) with ESMTPS id <0RJY00MP0E8JKC12@mta03.eastlink.ca> for zsh-users@zsh.org; Tue, 18 Oct 2022 11:47:05 -0300 (ADT) Received: from [192.168.0.2] ([24.207.18.108]) by Eastlink with ESMTPSA id kns0ofH8ulmAkkns1osyJS; Tue, 18 Oct 2022 11:47:05 -0300 X-Authority-Analysis: v=2.4 cv=Y/M9DjSN c=1 sm=1 tr=0 ts=634ebc69 a=xN66ZtSbq5jdJYpBp7G/jQ==:117 a=xN66ZtSbq5jdJYpBp7G/jQ==:17 a=IkcTkHD0fZMA:10 a=7Q6hFGWXdRYcLFNQ7lkA:9 a=QEXdDO2ut3YA:10 X-Vade-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrfeelvddgheduucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecugfetuffvnffkpffmpdfqfgfvnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefkffggfgfvhffutgfgsehtkeertddtfeejnecuhfhrohhmpeftrgihucetnhgurhgvfihsuceorhgrhigrnhgurhgvfihssegvrghsthhlihhnkhdrtggrqeenucggtffrrghtthgvrhhnpeevhedugeetieevveeiueethfffleehkeeugeehtdehgfetjeevhffgkefhieegffenucfkphepvdegrddvtdejrddukedruddtkeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpedvgedrvddtjedrudekrddutdekpdhhvghloheplgduledvrdduieekrddtrddvngdpmhgrihhlfhhrohhmpehrrgihrghnughrvgifshesvggrshhtlhhinhhkrdgtrgdpnhgspghrtghpthhtohepuddprhgtphhtthhopeiishhhqdhushgvrhhsseiishhhrdhorhhgpdhgvghtqdgkihhprfgrshhsfigupehtrhhuvg X-Vade-Score: -100 X-Vade-State: 0 X-EL-AUTH: rayandrews@eastlink.ca Message-id: <4b6eb0b7-ae82-a81f-6a70-784ffc1d39ff@eastlink.ca> Date: Tue, 18 Oct 2022 07:47:04 -0700 MIME-version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.3.0 Content-language: en-US To: Zsh Users From: Ray Andrews Subject: unintuitive bracketing with return value Content-type: text/plain; charset=UTF-8; format=flowed Content-transfer-encoding: 8bit X-Seq: 28223 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: I vaguely remember mentioning this before but I don't recall what the understanding should be: [ "${${1}##*[*?]*}" ] && { echo "no wildcards"; printenv "$1" } || echo wildcards present ... I'm obviously testing for the presence of wildcards before sending "$1" to 'printenv', unfortunately the '||' responds to the return value of 'printenv' and not, as I intend, for the '||' to respond to the first test (presence of wildcards).  If it was not bracketed there would be no issue of course, but shouldn't the brackets do the intuitive thing and  force the final '||' to be the alternative to the first '&&'?  It's easy to just write the thing as an 'if/else' statement and avoid the issue, but still the above seems very counter intuitive.  ... Tho of course one could get used to it and prefer it that way but still it seems weird.