summaryrefslogtreecommitdiffstats
path: root/bin/grepc
diff options
context:
space:
mode:
Diffstat (limited to 'bin/grepc')
-rwxr-xr-xbin/grepc15
1 files changed, 3 insertions, 12 deletions
diff --git a/bin/grepc b/bin/grepc
index 0bf900c..4f1001f 100755
--- a/bin/grepc
+++ b/bin/grepc
@@ -175,20 +175,11 @@ patterns="$(mktemp -t grepc.patterns.XXXXXX)";
) >"$patterns";
-opts='';
-opts="$opts $A";
-opts="$opts $B";
-opts="$opts $C";
-opts="$opts $c";
-opts="$opts $h";
-opts="$opts $i";
-opts="$opts $l";
-opts="$opts -M";
-opts="$opts $n";
+opts=($A $B $C $c $h $i $l -M $n);
if test -z "$*"; then
- pcre2grep $opts -f "$patterns";
+ pcre2grep "${opts[@]}" -f "$patterns";
else
find "$@" -type f \
| if test -z "$c"; then
@@ -196,7 +187,7 @@ else
else
cat;
fi \
- | xargs pcre2grep $opts -f "$patterns";
+ | xargs pcre2grep "${opts[@]}" -f "$patterns";
fi \
| sed -E -f <(test "$k" = 'no' && echo 's/^[^: ]+:[0-9]+:/\n\n&\n/') \
| perl -pe "$(test "$r" = 'yes' && echo 's/('"$identifier"')/\033[32m\1\033[0m/' || echo 's///')" \