]> git.lizzy.rs Git - rust.git/blobdiff - src/etc/cat-and-grep.sh
Rollup merge of #103952 - ehuss:dont-intra-linkcheck-reference, r=Mark-Simulacrum
[rust.git] / src / etc / cat-and-grep.sh
index 77dc52a9350706dd3cb7d7b1763b43c03b95ee1f..238f7f5b660277aa23c6715c3f20f29c08601410 100755 (executable)
@@ -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)