Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Deprecation of egrep



> 2022/09/12 14:32, I wrote:

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

Sorry, I forgot 'local line':

diff --git a/Test/ztst.zsh b/Test/ztst.zsh
index aca275c1c..d0e779f94 100755
--- a/Test/ztst.zsh
+++ b/Test/ztst.zsh
@@ -94,6 +94,15 @@ 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 () {
+  local line
+  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






Messages sorted by: Reverse Date, Date, Thread, Author