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.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 549 invoked from network); 18 Oct 2022 19:34:32 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 18 Oct 2022 19:34:32 -0000 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:Cc:To:From:Date:References:In-Reply-To:Message-Id: Mime-Version:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=MJW7X7Nv2zjCrr64MwSobxI7bhONxTs2vQY6IG28Djc=; b=EJKcncR4vtqdRHwwUGII2PRPhQ BPVtTe7pgf+CSdgXYPo3TdFKZdv9UUIcQjodRMCe6aWcawpe1wKiGaIxiQSZsC6dPYme8ZVpeuHMn i/KWMNt8sVMQV7Gua0vUe33oF4aWzPDD0V9N/dM5pUe1l1D+QSINcb4KjmQH17olnjgAbML2Pr7F1 JNzxyIhnDBFh2Tc7fd2Sh+YsF/l+Ff8L9G2NHhVFNMexS+aqhuYa7MhdIojUY22UwUntiwoDsT69n DHN9wRUfKqFrpyWRLyckzjmX+JjD/NDcg+sX0egC0g+I9exqdel4dc8+kWKazFYPWnf3wJrp/5ncz NKTCbE7Q==; Received: by zero.zsh.org with local id 1oksMB-0005bx-8E; Tue, 18 Oct 2022 19:34:31 +0000 Received: by zero.zsh.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1oksLP-0004wt-VB; Tue, 18 Oct 2022 19:33:44 +0000 Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailauth.nyi.internal (Postfix) with ESMTP id 0054727C005A; Tue, 18 Oct 2022 15:33:39 -0400 (EDT) Received: from imap48 ([10.202.2.98]) by compute2.internal (MEProxy); Tue, 18 Oct 2022 15:33:39 -0400 X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrfeelvddguddtlecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefofgggkfgjfhffhffvvefutgfgsehtqhertderreejnecuhfhrohhmpefn rgifrhgvnhgtvggpgggvlhojiihquhgviicuoehlrghrrhihvhesiihshhdrohhrgheqne cuggftrfgrthhtvghrnhepveeileekkeeuffetfeeiueduvdfftddvgffhheekledvvddt keelheeuiefhgedunecuffhomhgrihhnpeifohholhgvughgvgdrohhrghenucevlhhush htvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehlrghrrhihvhdomhgv shhmthhprghuthhhphgvrhhsohhnrghlihhthidqudduhedukeejjedtgedqudduledvje efkeehqdhlrghrrhihvheppeiishhhrdhorhhgsehfrghsthhmrghilhdrtghomh X-ME-Proxy: Feedback-ID: iaa214773:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id A987431A0063; Tue, 18 Oct 2022 15:33:39 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.7.0-alpha0-1047-g9e4af4ada4-fm-20221005.001-g9e4af4ad Mime-Version: 1.0 Message-Id: In-Reply-To: <22aaa8cc-48e9-90fc-f006-e8534858816d@eastlink.ca> References: <4b6eb0b7-ae82-a81f-6a70-784ffc1d39ff@eastlink.ca> <0ea47ef0-f039-41db-4514-b5b70045a9ef@gmx.com> <22aaa8cc-48e9-90fc-f006-e8534858816d@eastlink.ca> Date: Tue, 18 Oct 2022 15:32:23 -0400 From: =?UTF-8?Q?Lawrence_Vel=C3=A1zquez?= To: "Ray Andrews" Cc: zsh-users@zsh.org Subject: Re: unintuitive bracketing with return value Content-Type: text/plain;charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Seq: 28227 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 Tue, Oct 18, 2022, at 1:57 PM, Ray Andrews wrote: > On 2022-10-18 07:57, Eric Cook wrote: >> >> https://mywiki.wooledge.org/BashPitfalls#pf22 >> > Very well written!=C2=A0 What breaks my intuition tho is the brackets.= =C2=A0=20 > Otherwise I quite understand that the last exit value is the active=20 > one.=C2=A0 I'm expecting the brackets to 'contain' the rv of any comma= nds=20 > within the brackets.=C2=A0 But no, the left > right rule applies and t= he=20 > brackets don't make any difference. I don't understand why you keep saying this. Without the braces your command would be completely different. This: [ "${${1}##*[*?]*}" ] && echo "no wildcards"; printenv "$1" || echo wildcards present is equivalent to this: [ "${${1}##*[*?]*}" ] && echo "no wildcards" printenv "$1" || echo wildcards present which is not at all what you want. --=20 vq