help / color / mirror / code / Atom feed
From: Jun T <takimoto-j@kba.biglobe.ne.jp>
To: zsh-workers@zsh.org
Subject: Re: Deprecation of egrep
Date: Mon, 12 Sep 2022 14:32:40 +0900	[thread overview]
Message-ID: <C7E115D5-E763-4146-B50B-967FB1EFF034@kba.biglobe.ne.jp> (raw)
In-Reply-To: <C59B850E-07CF-4E31-A1A2-BA431A9155BA@umbrellix.net>

> 2022/09/11 2:26, Ellenor Bjornsdottir <ellenor@umbrellix.net> wrote:
> grep from which system? GNU?

GNU grep-3.8. At least Debian-sid and the latest Arch Linux already use it.

> 2022/09/11 1:04, Vin Shelton <acs@alumni.princeton.edu> wrote:
> Changing all occurrences of "egrep" to "grep -E" in our test scripts will fix this.

It works on Linux, {Free,Open,Net,Dragonfly}BSD, macOS and Cygwin.
But I'm not sure if it works on Solaris (and other commercial UNIXes) or not.
Online Solaris manpage indicates that /usr/bin/grep does not accept -E
(although /usr/xpg4/bin/grep accepts it).

Could someone test on Solaris etc.?

> 2022/09/11 9:10, Bart Schaefer <schaefer@brasslantern.com> wrote:
> A quick check reveals six uses, all of which could be replaced with
> zsh pattern matching 

If we can not simply replace egrep by 'grep -E', this would be the simplest
fix; see the patch below.

configure sets EGREP to either 'grep -E' or 'egrep', so propagating this
to ztst.zsh (in some way) would be another (more complex) possibility.

diff --git a/Test/ztst.zsh b/Test/ztst.zsh
index aca275c1c..248180b34 100755
--- a/Test/ztst.zsh
+++ b/Test/ztst.zsh
@@ -94,6 +94,14 @@ tail() {
   command tail "$argv[@]"
+# Define our egrep (works only as a pipe). GNU grep-3.8 forces us to use
+# 'grep -E' instead of egrep, but on some systems grep may not accept -E.
+egrep () {
+  while read line; do
+    [[ $line = *(${~1})* ]] && print $line
+  done
 # The source directory is not necessarily the current directory,
 # but if $0 doesn't contain a `/' assume it is.
 if [[ $0 = */* ]]; then

  reply	other threads:[~2022-09-12  5:38 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-10 16:04 Vin Shelton
2022-09-10 17:26 ` Ellenor Bjornsdottir
2022-09-12  5:32   ` Jun T [this message]
2022-09-12  7:30     ` Jun T
2022-09-12  9:08       ` Daniel Shahaf
2022-09-12 10:15         ` Jun T
2022-09-12 10:49           ` Peter Stephenson
2022-09-12 15:27             ` Vin Shelton
2022-09-13  4:33               ` Jun T
2022-09-23 17:14                 ` Jun. T
2022-09-11  0:10 ` Bart Schaefer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=C7E115D5-E763-4146-B50B-967FB1EFF034@kba.biglobe.ne.jp \
    --to=takimoto-j@kba.biglobe.ne.jp \
    --cc=zsh-workers@zsh.org \


* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).