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 19494 invoked from network); 5 Dec 2022 06:42:47 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 5 Dec 2022 06:42:47 -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=SkCKlfcR6FCjrrnVgaKwpE/r7OcxuICi1euLt1e+qz0=; b=R6hYL7BiFHi12QZDCvblPZm7Ik 9JgdWfSI+S/Zrz9fqvPtyaYSOskskuOUYQmCopCvKtjJHMuzr0pfwDkPa5M7Jr29JiC9+5k4uxehN RqlJe+lWk6w8qFXd60Juomgy3A74JipPRQfhC0G81ig6hd4d+0/JHMXFtgNzJ7RHXf09tSgMrNp1R Hb9+qzLkfazzVX91rlEW/C3ri7oxpCvEkYPoa9HYQqLkV+9YjKCtn4Dkh17yl5UxvIbQOE8iURo9m 24m7cCDk6Svm4bDdNv3tdVbDjIMQvynpIWyTgq1ih25/qWyoPcYSvqdvPYYFfgEoexTiBmG76hUGh rtbSfQbg==; Received: by zero.zsh.org with local id 1p25Be-000KMo-Db; Mon, 05 Dec 2022 06:42:46 +0000 Received: by zero.zsh.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1p25Aw-000Ji9-DX; Mon, 05 Dec 2022 06:42:02 +0000 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailauth.nyi.internal (Postfix) with ESMTP id 7F67527C0054; Mon, 5 Dec 2022 01:42:00 -0500 (EST) Received: from imap48 ([10.202.2.98]) by compute1.internal (MEProxy); Mon, 05 Dec 2022 01:42:00 -0500 X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrudefgddutddtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepofgfggfkjghffffhvfevufgtgfesthhqredtreerjeenucfhrhhomhepnfgr fihrvghntggvucggvghljoiiqhhuvgiiuceolhgrrhhrhihvseiishhhrdhorhhgqeenuc ggtffrrghtthgvrhhnpedvtddulefgjefgieegfeetueeiieefteelheefhfetgfellefg udetvdejudffgfenucffohhmrghinhepfihoohhlvggughgvrdhorhhgnecuvehluhhsth gvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheplhgrrhhrhihvodhmvghs mhhtphgruhhthhhpvghrshhonhgrlhhithihqdduudehudekjeejtdegqdduudelvdejfe ekhedqlhgrrhhrhihvpeepiihshhdrohhrghesfhgrshhtmhgrihhlrdgtohhm X-ME-Proxy: Feedback-ID: iaa214773:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id 3005A31A0063; Mon, 5 Dec 2022 01:42:00 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.7.0-alpha0-1115-g8b801eadce-fm-20221102.001-g8b801ead Mime-Version: 1.0 Message-Id: <8fc6bf49-3463-4432-b706-15b49d19a9b5@app.fastmail.com> In-Reply-To: References: <9d81fc7d-aa60-9b6a-47df-6fc677b933f9@eastlink.ca> <63ae2364-1bba-405d-a1e6-4813df512340@app.fastmail.com> Date: Mon, 05 Dec 2022 01:40:37 -0500 From: =?UTF-8?Q?Lawrence_Vel=C3=A1zquez?= To: "Ray Andrews" Cc: zsh-users@zsh.org Subject: Re: trivial question Content-Type: text/plain;charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Seq: 28479 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 Mon, Dec 5, 2022, at 12:20 AM, Ray Andrews wrote: > On 2022-12-04 18:52, Lawrence Vel=C3=A1zquez wrote: >> In this context, "var[2]" is recognized as a valid glob, and zsh >> attempts to generate filenames with it. If a file or directory >> matches, its name is inserted as usual. > I see.=C2=A0 A file glob would be the last thing I'd be expecting, I'm=20 > expecting it to be a nothing but a string. It's common enough to forget (or not know) that globs support bracket expressions. Most unquoted uses like yours are incorrect and can produce unexpected results if they actually match anything (as unlikely as that might be). % var=3D(a b c) % var1=3Dhello % unset var[1] zsh: no matches found: var[1] % typeset -p var var1 typeset -a var=3D( a b c ) typeset var1=3Dhello % : >var1 % unset var[1] =20 % typeset -p var var1 typeset: no such variable: var1 typeset -a var=3D( a b c ) % unset 'var[1]' =20 % typeset -p var var1 typeset: no such variable: var1 typeset -a var=3D( '' b c ) See also: https://mywiki.wooledge.org/BashPitfalls#unset_a.5B0.5D >> % zsh +o NOMATCH foo.zsh >> >> > That works.=C2=A0 First experiments trying '(un)setopt NOMATCH' aren't=20 > working but now that I know what to chew on I'll bag it. That was a demonstration of behavior, not a suggestion to disable NOMATCH. Leaving unmatched globs intact is rarely what you want. % setopt NOMATCH NO_NULL_GLOB % touch nonexistent* zsh: no matches found: nonexistent* % ls % unsetopt NOMATCH % touch nonexistent* % ls nonexistent* You really need to get out of the habit of enabling/disabling options that you don't understand just because one of us explains how they change some behavior or other. You did the same thing with ERR_EXIT in users/28432, and it was equally misguided. The correct remedy here, as usual, is to quote properly, not fiddle with options. --=20 vq