diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2022-10-14 23:43:42 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-10-14 23:43:42 +0200 |
| commit | f72d76df5a1d4acc134e3cb03f61dec7d53eb18e (patch) | |
| tree | 8e279558613fd9c61cf44a525ceac43afac1674d | |
| parent | 5819f419a7b9fcda92b74ab2c48010a778eaec40 (diff) | |
| parent | 6135aff27cedcf81ff863715685808829364f7cb (diff) | |
| download | rust-f72d76df5a1d4acc134e3cb03f61dec7d53eb18e.tar.gz rust-f72d76df5a1d4acc134e3cb03f61dec7d53eb18e.zip | |
Rollup merge of #102092 - kxxt:patch-1, r=joshtriplett
refactor: use grep -E/-F instead of fgrep/egrep `egrep` and `fgrep` are obsolescent now. This PR updates all `egrep` and `fgrep` commands to `grep -E` and `grep -F`. Running egrep/fgrep command with grep v3.8 will output the following warning to stderr: ``` egrep: warning: egrep is obsolescent; using grep -E ``` - https://www.phoronix.com/news/GNU-Grep-3.8-Stop-egrep-fgrep - https://lists.gnu.org/archive/html/info-gnu/2022-09/msg00001.html
| -rwxr-xr-x | src/etc/cat-and-grep.sh | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/etc/cat-and-grep.sh b/src/etc/cat-and-grep.sh index 77dc52a9350..238f7f5b660 100755 --- a/src/etc/cat-and-grep.sh +++ b/src/etc/cat-and-grep.sh @@ -26,7 +26,7 @@ Options: -i Case insensitive search. ' -GREPPER=fgrep +GREPPER=grep INVERT=0 GREPFLAGS='q' while getopts ':vieh' OPTION; do @@ -39,7 +39,7 @@ while getopts ':vieh' OPTION; do GREPFLAGS="i$GREPFLAGS" ;; e) - GREPPER=egrep + GREPFLAGS="E$GREPFLAGS" ;; h) echo "$USAGE" @@ -51,6 +51,12 @@ while getopts ':vieh' OPTION; do esac done +if ! echo "$GREPFLAGS" | grep -q E +then + # use F flag if there is not an E flag + GREPFLAGS="F$GREPFLAGS" +fi + shift $((OPTIND - 1)) # use gnu version of tool if available (for bsd) |
