From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.5 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=3.4.4 Received: from zero.zsh.org (zero.zsh.org [IPv6:2a02:898:31:0:48:4558:7a:7368]) by inbox.vuxu.org (Postfix) with ESMTP id 0C1C820CAE for ; Tue, 2 Apr 2024 22:14:56 +0200 (CEST) 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=JT54OxN5QVIwjOY9x3DTBKjH931lkQpB8px9GJoSP/I=; b=r5tz0LlalDT0YtuPUBHiNR3SzC ECAt8jk7JXSSTyqG5q4stJBBglfMuEIWwbLCMpDL0LBgq2YGoQU89ZYeLq3s5gjj0TQfFRuU+Muzb Qs6u46ws7RpI312Ti8ehPJD2ZKDX61WnhbCdt2hsxofBB76RUjbOqFdts6vKgpnuY6Hv7kQK6c+I3 bcXoK/Ps24U/BQ1FdTfy4DEvhxBDg4p/QrF1KLmFm1FgNMzlyYSvs7FAH1Nuu4suUD/oSEM6NwMZV mkuNq7hlR7S8AOZYXL1DHEFbgIy4OTd/m5tKF7n07Tg4OCAiVrOavpM489/YB2ZFp0LjFpmrrZpmJ wxsIfwfA==; Received: by zero.zsh.org with local id 1rrkX2-000Ovb-HK; Tue, 02 Apr 2024 20:14:56 +0000 Received: by zero.zsh.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1rrkWa-000OFc-6q; Tue, 02 Apr 2024 20:14:28 +0000 Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailfauth.nyi.internal (Postfix) with ESMTP id 958941200089; Tue, 2 Apr 2024 16:14:26 -0400 (EDT) Received: from imap48 ([10.202.2.98]) by compute2.internal (MEProxy); Tue, 02 Apr 2024 16:14:26 -0400 X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrudefvddgudegiecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefofgggkfgjfhffhffvvefutgesthdtredtreerjeenucfhrhhomhepnfgr fihrvghntggvucggvghljoiiqhhuvgiiuceolhgrrhhrhihvseiishhhrdhorhhgqeenuc ggtffrrghtthgvrhhnpeelkeehjefgudefgeekueegudeghfevvdeljeehieeuffehveej gfehtefhudevhfenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfh hrohhmpehlrghrrhihvhdomhgvshhmthhprghuthhhphgvrhhsohhnrghlihhthidquddu hedukeejjedtgedqudduledvjeefkeehqdhlrghrrhihvheppeiishhhrdhorhhgsehfrg hsthhmrghilhdrtghomh X-ME-Proxy: Feedback-ID: iaa214773:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id 59D2C31A0065; Tue, 2 Apr 2024 16:14:26 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.11.0-alpha0-333-gbfea15422e-fm-20240327.001-gbfea1542 MIME-Version: 1.0 Message-Id: <85dd54c7-d221-4c19-b3f5-8d8d251529f2@app.fastmail.com> In-Reply-To: <7318f96a-c6ff-426b-aa64-93b8ea6ee9c1@eastlink.ca> References: <7318f96a-c6ff-426b-aa64-93b8ea6ee9c1@eastlink.ca> Date: Tue, 02 Apr 2024 16:14:05 -0400 From: =?UTF-8?Q?Lawrence_Vel=C3=A1zquez?= To: "Ray Andrews" Cc: zsh-users@zsh.org Subject: Re: egrep --color=always 'zsh\.' Content-Type: text/plain X-Seq: 29765 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, Apr 2, 2024, at 12:33 PM, Ray Andrews wrote: > % apt-file search zsh. | egrep --color=always 'zsh\.' > > ... if using egrep, the above makes sure that the dot is taken > literally. I have a function that ends up trying to create the above: > > % func 'zsh\.' > > ... which will attempt: > > apt-file search "$1" | egrep --color=always $1 > > ... and it works fine unless I want to force a literal char, as above. The issue is probably that you are using the same pattern for both "apt-file search" and egrep, but they don't interpret it in the same way. By default, "apt-file search" does a literal substring match, so "\." will match backslash-period. The function as presented cannot actually work with regex arguments, so just switch to "grep -F" and avoid the escaping issues altogether. (While apt-file does have a --regexp option, it uses Perl regexp, not the POSIX and PCRE languages supported by GNU grep.) func() { apt-file search $1 | grep -F --color=always -- $1 } > zsh is removing the quotes as she properly does Please refrain from referring to zsh as "she". The shell is neither a woman nor a ship. > but in this case I need to preserve them since egrep needs them. No, egrep does not need the quotes. > I know I've done this > before. Something in the (Q) continuum? It has to be egrep since I > normally want the regex interpretation, it's just this odd case where I > need a regex char forced literal. I know it's doable. You don't have a shell issue, so this is not necessary. -- vq