From: Alejandro Colomar Date: Tue, 4 Nov 2025 14:18:43 +0000 (+0100) Subject: src/bin/grepc: -r: Simplify implementation, removing a conditional X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=0a17ccb328bf300a07d2b49dd8860a25c09e5c42;p=thirdparty%2Fman-pages.git src/bin/grepc: -r: Simplify implementation, removing a conditional Signed-off-by: Alejandro Colomar --- diff --git a/src/bin/grepc b/src/bin/grepc index 70e312abe..03db8e7ef 100755 --- a/src/bin/grepc +++ b/src/bin/grepc @@ -17,7 +17,7 @@ i=''; l=''; m=''; n=''; -r='no'; +r='never'; t=''; x='c'; @@ -40,7 +40,7 @@ while getopts "A:B:C:chilm:nrt:x:" opt; do l) l='-l'; ;; m) m="-m$OPTARG"; ;; n) n='-n'; ;; - r) r='yes'; ;; + r) r='always'; ;; t) t="$t -t$OPTARG"; ;; x) x="$OPTARG"; ;; \? | *) exit 2; ;; @@ -77,11 +77,7 @@ else fi \ | xargs -0 sh -c 'pcre2grep $opts -f "$0" -- "$@" || test $? -eq 1;' "$patterns"; fi \ -| if test "$r" = 'yes'; then - grep -h --color=always -P "($identifier|^)"; -else - cat; -fi \ +| grep -h --color="$r" -P "($identifier|^)" \ | if test -n "$l"; then sort \ | uniq;