X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=src%2Fetc%2Fcat-and-grep.sh;h=238f7f5b660277aa23c6715c3f20f29c08601410;hb=35c3ca2eea4aa1c43cf7727ded077ad325967bb4;hp=77dc52a9350706dd3cb7d7b1763b43c03b95ee1f;hpb=2b30ce04ac23aaea8d35502aa67079f1072cad2d;p=rust.git 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)