about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rwxr-xr-xsrc/etc/cat-and-grep.sh10
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)