]> git.ipfire.org Git - thirdparty/man-pages.git/commitdiff
src/bin/grepc: Refactor to avoid process substitution
authorAlejandro Colomar <alx@kernel.org>
Thu, 30 Oct 2025 09:41:55 +0000 (10:41 +0100)
committerAlejandro Colomar <alx@kernel.org>
Fri, 31 Oct 2025 11:23:01 +0000 (12:23 +0100)
Signed-off-by: Alejandro Colomar <alx@kernel.org>
src/bin/grepc

index f0efba36e8a3e5d8f745b4dec43099dc0e4e2176..1758320dfa7dc1853bb4c515d592db01f510bf44 100755 (executable)
@@ -247,14 +247,11 @@ else
        fi \
        | xargs -0 pcre2grep "${opts[@]}" -f "$patterns";
 fi \
-| perl -p <(
-       # shellcheck disable=SC2312  # We don't care about failures here.
-       if test "$r" = 'yes'; then
-               printf '%s\n' 's/('"$identifier"')/\033[32m\1\033[0m/';
-       else
-               printf '%s\n' 's///';
-       fi;
-) \
+| if test "$r" = 'yes'; then
+       perl -p -e 's/('"$identifier"')/\033[32m\1\033[0m/';
+else
+       cat;
+fi \
 | if test -n "$l"; then
        sort \
        | uniq;