From 149130a88928a84d552106b47e707a032ccacfb5 Mon Sep 17 00:00:00 2001 From: Urban Modig Date: Wed, 1 Oct 2025 11:41:25 +0200 Subject: [PATCH] fix set -e --- download.sh | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/download.sh b/download.sh index 97112a9..709137e 100755 --- a/download.sh +++ b/download.sh @@ -317,11 +317,20 @@ done (( DEBUG )) && { log "Debug mode enabled"; set -x; } # Enforce mutual exclusivity between -c, -p, -f -# (avoid set -e pitfalls by not looping over empty args) +# Use explicit if-blocks (safe with 'set -e') and avoid short-circuit pitfalls count=0 -[[ -n $collection ]] && ((count++)) -[[ -n $post ]] && ((count++)) -[[ -n $file ]] && ((count++)) +if [[ -n $collection ]]; then + ((count++)) + log "Count++ via collection" +fi +if [[ -n $post ]]; then + ((count++)) + log "Count++ via post" +fi +if [[ -n $file ]]; then + ((count++)) + log "Count++ via file" +fi log "Arg summary: collection='${collection:-}' post='${post:-}' file='${file:-}' (count=$count)" if (( count != 1 )); then