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=-1.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 31867 invoked from network); 10 Nov 2023 16:35:14 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 10 Nov 2023 16:35:14 -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-Type:Subject:Cc:To:From:Date: References:In-Reply-To:Message-Id:MIME-Version:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=fQOesutca3mgzK3/QBxuglg3E08BO7yzEYWQDBzZq6Y=; b=G+ERwIqDcTOHXy2IiI0Uxi61c3 L1DhTxXGEuMKO7JQII36j0WuVMwyDXZzFep6wPtOI+xW4af3nxgpKVFm4qchOHpXKORTb1tsECiDT BCkA759pgikgKa5RJ1zg6357BcwqMcVFfVYLFJhylY4rBgqeHeLGcPO5cGKBZCt3ordHuQDii/pcO XQ08WznWFQQ762EJ5Fj0l1i6/RIvQud7qPxJBcj5DHzorvOHxNKxkkE7RnvH40/INEv061z5DBe9Z oG2ryDqRQOc9zVvEhnNv9c9gukjSSebetwIqe8nSU6D6kxGGvBTfreI8ZhLenJZDgOOrjP2+dOMGA oHka5RUQ==; Received: by zero.zsh.org with local id 1r1UTQ-000Gta-Qi; Fri, 10 Nov 2023 16:35:12 +0000 Received: by zero.zsh.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1r1USf-000GBJ-A9; Fri, 10 Nov 2023 16:34:26 +0000 Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailauth.nyi.internal (Postfix) with ESMTP id 9A41227C0054; Fri, 10 Nov 2023 11:34:23 -0500 (EST) Received: from imap48 ([10.202.2.98]) by compute2.internal (MEProxy); Fri, 10 Nov 2023 11:34:23 -0500 X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedruddvfedgkeejucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepofgfggfkjghffffhvfevufgtsehttdertderreejnecuhfhrohhmpefnrgif rhgvnhgtvgcugggvlhojiihquhgviicuoehlrghrrhihvhesiihshhdrohhrgheqnecugg ftrfgrthhtvghrnhepleekheejgfdufeegkeeugedugefhvedvleejheeiueffheevjefg heethfduvefhnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrh homheplhgrrhhrhihvodhmvghsmhhtphgruhhthhhpvghrshhonhgrlhhithihqdduudeh udekjeejtdegqdduudelvdejfeekhedqlhgrrhhrhihvpeepiihshhdrohhrghesfhgrsh htmhgrihhlrdgtohhm X-ME-Proxy: Feedback-ID: iaa214773:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id 3CB6531A0065; Fri, 10 Nov 2023 11:34:23 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.9.0-alpha0-1108-g3a29173c6d-fm-20231031.005-g3a29173c MIME-Version: 1.0 Message-Id: <5792009a-ef88-428c-be93-feeaa23aad7e@app.fastmail.com> In-Reply-To: References: Date: Fri, 10 Nov 2023 11:33:35 -0500 From: =?UTF-8?Q?Lawrence_Vel=C3=A1zquez?= To: "Roman Perepelitsa" , linuxtechguy@gmail.com Cc: zsh-users@zsh.org Subject: Re: special characters in file names issue Content-Type: text/plain X-Seq: 29340 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 Fri, Nov 10, 2023, at 4:50 AM, Roman Perepelitsa wrote: > Associative arrays in zsh are finicky when it comes to the content of > their keys. The problem you are experiencing can be distilled to this: > > % typeset -A dict > % key='(' > % [[ -v dict[$key] ]] > zsh: invalid subscript > > There is no simple quoting that you can apply to $key here: (q), (b), > etc. are all wrong. You could perhaps escape a specific list of > characters ('(', '[', '{' but not '$' or '*') although my memory tells > me that some keys cannot be made to work under `[[ -v ...]]` or > `unset` no matter how you try to escape them. I could be wrong though. Subscripted arguments to [[ -v ... ]] appear to undergo a second round of expansions, so quoting "$key" itself should be sufficient. % typeset -A dict=('(' foo) % key='(' % [[ -v dict[\$key] ]]; echo $? 0 % [[ -v dict['$key'] ]]; echo $? 0 % [[ -v 'dict[$key]' ]]; echo $? 0 -- vq