File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ Options:
2626 -i Case insensitive search.
2727'
2828
29- GREPPER=fgrep
29+ GREPPER=grep
3030INVERT=0
3131GREPFLAGS=' q'
3232while 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,15 @@ while getopts ':vieh' OPTION; do
5151 esac
5252done
5353
54+ # an utility function to check if a string contains a substring
55+ stringContain () { [ -z " $1 " ] || { [ -z " ${2##* $1 * } " ] && [ -n " $2 " ]; }; }
56+
57+ if ! stringContain ' E' " $GREPFLAGS "
58+ then
59+ # use F flag if there is not an E flag
60+ GREPFLAGS=" F$GREPFLAGS "
61+ fi
62+
5463shift $(( OPTIND - 1 ))
5564
5665# use gnu version of tool if available (for bsd)
You can’t perform that action at this time.
0 commit comments