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:
26
26
-i Case insensitive search.
27
27
'
28
28
29
- GREPPER=fgrep
29
+ GREPPER=grep
30
30
INVERT=0
31
31
GREPFLAGS=' q'
32
32
while getopts ' :vieh' OPTION; do
@@ -39,7 +39,7 @@ while getopts ':vieh' OPTION; do
39
39
GREPFLAGS=" i$GREPFLAGS "
40
40
;;
41
41
e)
42
- GREPPER=egrep
42
+ GREPFLAGS= " E $GREPFLAGS "
43
43
;;
44
44
h)
45
45
echo " $USAGE "
@@ -51,6 +51,15 @@ while getopts ':vieh' OPTION; do
51
51
esac
52
52
done
53
53
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
+
54
63
shift $(( OPTIND - 1 ))
55
64
56
65
# use gnu version of tool if available (for bsd)
You can’t perform that action at this time.
0 commit comments