From ceac2c2a57fcc567fe23aa2895cbcf99321a2c21 Mon Sep 17 00:00:00 2001 From: Rohan Kumar Date: Wed, 29 Nov 2023 13:37:48 -0800 Subject: [PATCH] Switch from find -exec to xargs --- scripts/xhtmlize.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/scripts/xhtmlize.sh b/scripts/xhtmlize.sh index 1d56c24..1958e63 100644 --- a/scripts/xhtmlize.sh +++ b/scripts/xhtmlize.sh @@ -3,7 +3,8 @@ # Runs xhtmlize-single-file.sh on every single html file in the output dir. # exits if xhtmlize-single-file fails. -# no pipefail here since there are no pipes. +#shellcheck disable=SC3040 # This only sets pipefail if it's available and otherwise does nothing +set -o pipefail 2>/dev/null || true set -e -u output_dir="$1" @@ -25,5 +26,5 @@ trap cleanup EXIT export XMLLINT_INDENT=' ' export OUTPUT_DIR="$output_dir" -find "$output_dir" -type f -name '*.html' -exec sh "$script_dir/xhtmlize-single-file.sh" {} \; -find "$output_dir" -type f -name '*.xml' -exec xmllint --noblanks --encode UTF-8 --noent {} --output {} \; +find "$output_dir" -type f -name '*.html' | xargs -n1 sh "$script_dir/xhtmlize-single-file.sh" +find "$output_dir" -type f -name '*.xml' | xargs -I_ xmllint --noblanks --encode UTF-8 --noent _ --output _