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,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 12764 invoked from network); 11 Aug 2021 21:46:35 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 11 Aug 2021 21:46:35 -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=4PnOYxTjOqCDudQtYMY14fvwFrbUCuK7aDCm8KA8fYM=; b=AesSWvAwq/6imLkN0xrtySoUMF b07yFrRpwBZyqg0aRH7R2MG9BJAfdKFpdx03A1vP9SnixFqZNwGTQdhKipvxrND2SudkKGD6NfmGh 748wpq8xPL61NQfUrZYJOJeh9wEaI5/vlHPCxBgejYMNl/zy63Z3YkI5sSQhiCgmoDJYJcP9kdGDp 05Dnac0qbzOkI/huhtB2hW/Z+FBo2X5DcZzdam+a90RSbYj5UWTULI6MAGNO/Ufj2KnfoqV55M6W/ G7+RwqY4tHCm0rAb/smUwUCacxBnezd9BBQXkn2AbRA0qJ9ys+mJf7WwwHx+H+Xp6yWiT9CDV6rKO 8f4K/aYg==; Received: from authenticated user by zero.zsh.org with local id 1mDw3X-0008CK-4w; Wed, 11 Aug 2021 21:46:35 +0000 Received: from authenticated user by zero.zsh.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1mDw1y-0007PI-P2; Wed, 11 Aug 2021 21:44:59 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailauth.nyi.internal (Postfix) with ESMTP id B8A5227C0054; Wed, 11 Aug 2021 17:44:56 -0400 (EDT) Received: from imap2 ([10.202.2.52]) by compute3.internal (MEProxy); Wed, 11 Aug 2021 17:44:56 -0400 X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrkedvgddtudcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefofgggkfgjfhffhffvufgtsehttdertderreejnecuhfhrohhmpefnrgifrhgv nhgtvggpgggvlhojiihquhgviicuoehlrghrrhihvhesiihshhdrohhrgheqnecuggftrf grthhtvghrnhepieekjeevledugeefiefgueelgffgtddtgeehvedvhedviefghedvffeu vddvueehnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomh eplhgrrhhrhihvodhmvghsmhhtphgruhhthhhpvghrshhonhgrlhhithihqdduudehudek jeejtdegqdduudelvdejfeekhedqlhgrrhhrhihvpeepiihshhdrohhrghesfhgrshhtmh grihhlrdgtohhm X-ME-Proxy: Received: by mailuser.nyi.internal (Postfix, from userid 501) id 33CF5A03D5D; Wed, 11 Aug 2021 17:44:56 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.5.0-alpha0-554-g53a5f93b7d-fm-20210809.002-g53a5f93b Mime-Version: 1.0 Message-Id: <27bc215c-3916-4afe-b8b3-7946dd0cb4bc@www.fastmail.com> In-Reply-To: References: Date: Wed, 11 Aug 2021 17:42:09 -0400 From: =?UTF-8?Q?Lawrence_Vel=C3=A1zquez?= To: "Zach Riggle" Cc: "Bart Schaefer" , zsh-users@zsh.org Subject: =?UTF-8?Q?Re:_Odd_behavior_with_various_(q)_array_modifiers_and_non-prin?= =?UTF-8?Q?table_characters_(backspace,_newline)?= Content-Type: text/plain X-Seq: 26920 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 Wed, Aug 11, 2021, at 5:16 PM, Bart Schaefer wrote: > You need to stop testing things with "echo". The "echo" builtin > interprets some backslash escapes itself, which will confuse you about > what the quoting options have done. > > Repeat all your tests instead with > printf "%s\n" ${(q)...} > and so on, and come back if you still have questions. Additionally, \b and \n are not interpreted in double quotes, so your initial data does not actually contain BS or NL characters. Presumably you thought "..." works like $'...'. % mysed_orig=( gsed "s/\ba\b/x/" ) % typeset -p mysed_orig typeset -a mysed_orig=( gsed 's/\ba\b/x/' ) % mysed_fixed=(gsed $'s/\ba\b/x/') % typeset -p mysed_fixed typeset -a mysed_fixed=( gsed $'s/\C-Ha\C-H/x/' ) % newline_orig=( aa "b\nb" cc ) % typeset -p newline_orig typeset -a newline_orig=( aa 'b\nb' cc ) % newline_fixed=( aa $'b\nb' cc ) % typeset -p newline_fixed typeset -a newline_fixed=( aa $'b\nb' cc ) As per the QUOTING section of zshmisc(1): Inside double quotes (""), parameter and command substitution occur, and `\' quotes the characters `\', ``', `"', `$', and the first character of $histchars (default `!'). -- vq