1
Fork 0

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
This commit is contained in:
Matthias Krüger 2022-10-14 23:43:42 +02:00 committed by GitHub
commit f72d76df5a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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)