Skip to content

Commit f72d76d

Browse files
authored
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
2 parents 5819f41 + 6135aff commit f72d76d

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/etc/cat-and-grep.sh

+8-2
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Options:
2626
-i Case insensitive search.
2727
'
2828

29-
GREPPER=fgrep
29+
GREPPER=grep
3030
INVERT=0
3131
GREPFLAGS='q'
3232
while getopts ':vieh' OPTION; do
@@ -39,7 +39,7 @@ while getopts ':vieh' OPTION; do
3939
GREPFLAGS="i$GREPFLAGS"
4040
;;
4141
e)
42-
GREPPER=egrep
42+
GREPFLAGS="E$GREPFLAGS"
4343
;;
4444
h)
4545
echo "$USAGE"
@@ -51,6 +51,12 @@ while getopts ':vieh' OPTION; do
5151
esac
5252
done
5353

54+
if ! echo "$GREPFLAGS" | grep -q E
55+
then
56+
# use F flag if there is not an E flag
57+
GREPFLAGS="F$GREPFLAGS"
58+
fi
59+
5460
shift $((OPTIND - 1))
5561

5662
# use gnu version of tool if available (for bsd)

0 commit comments

Comments
 (0)