From 22021fc8e375dd9a7a57acaecab8873cda1a1475 Mon Sep 17 00:00:00 2001 From: "Dustin J. Mitchell" Date: Sun, 30 Nov 2025 22:43:34 -0500 Subject: [PATCH] Use shell conditionals instead of && shortcuts Because this script runs with `set -e`, the `someboolean && some action` approach causes the shell to exit, as that statement evaluates to false when `someboolean` is false. --- bin/backup-github-repo.sh | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/bin/backup-github-repo.sh b/bin/backup-github-repo.sh index 29dd5c9..fd3ae08 100755 --- a/bin/backup-github-repo.sh +++ b/bin/backup-github-repo.sh @@ -47,8 +47,9 @@ mkdir -p "${folder_name}/html" # Executables declared in package.json backup-github-repo_init_config -${include_json} && download-github-repo-json "$folder_name" "$url" -${include_html} && download-github-repo-html "$folder_name" "$url" - -# Prevent "include_html" to trigger an unnecessary non-zero exit code -true +if ${include_json}; then + download-github-repo-json "$folder_name" "$url" +fi +if ${include_html}; then + download-github-repo-html "$folder_name" "$url" +fi