From 866ca1b386aa8446772f1d95ee9b24effef9c44c Mon Sep 17 00:00:00 2001 From: Rohan Kumar Date: Sun, 26 Nov 2023 15:12:35 -0800 Subject: [PATCH] Switch soem things from find -exec to xargs Allows better filtering and doesn't supress exit codes. Since I'm no longer supressing exit codes, I had to handle them properly in copy-file-to-xhtml.sh by using if-statements. This also allowed me to skip the generation of an XHTML redirect page. --- Makefile | 2 +- scripts/copy-file-to-xhtml.sh | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 88113cd..85c24af 100644 --- a/Makefile +++ b/Makefile @@ -128,7 +128,7 @@ xhtmlize: .PHONY: copy-to-xhtml copy-to-xhtml: - find $(OUTPUT_DIR) -type f -name "*.html" -exec sh scripts/copy-file-to-xhtml.sh {} \; + find $(OUTPUT_DIR) -type f -name "*.html" | grep -v 'resume/index.html' | xargs -n1 sh scripts/copy-file-to-xhtml.sh .PHONY: deploy-html deploy-html: diff --git a/scripts/copy-file-to-xhtml.sh b/scripts/copy-file-to-xhtml.sh index 7e3cb69..412ffef 100644 --- a/scripts/copy-file-to-xhtml.sh +++ b/scripts/copy-file-to-xhtml.sh @@ -9,5 +9,9 @@ html_file="$1" xhtml_file="${html_file%*.html}.xhtml" cp -p "$html_file" "$xhtml_file" -[ -f "$html_file.gz" ] && cp -p "$html_file.gz" "$xhtml_file.gz" -[ -f "$html_file.br" ] && cp -p "$html_file.br" "$xhtml_file.br" +if [ -f "$html_file.gz" ]; then + cp -p "$html_file.gz" "$xhtml_file.gz" +fi +if [ -f "$html_file.br" ]; then + cp -p "$html_file.br" "$xhtml_file.br" +fi