From 19aca5170684b4f962aba3b1e2484da4aa510faf Mon Sep 17 00:00:00 2001 From: Urban Modig Date: Wed, 1 Oct 2025 11:20:42 +0200 Subject: [PATCH] fix set -e --- download.sh | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/download.sh b/download.sh index 6c8b608..bf00655 100755 --- a/download.sh +++ b/download.sh @@ -319,8 +319,17 @@ done # Enforce mutual exclusivity between -c, -p, -f set -- "$collection" "$post" "$file" count=0 -for x in "$@"; do [[ -n $x ]] && ((count++)); done -(( count == 1 )) || { usage; die "Options -c, -p och -f kan inte användas samtidigt (exakt en krävs)."; } +for x in "$@"; do + if [[ -n $x ]]; then + ((count++)) + fi +done +# Ensure a zero exit status here to avoid set -e exiting if the last test was false +true +if (( count != 1 )); then + usage + die "Options -c, -p och -f kan inte användas samtidigt (exakt en krävs)." +fi lock log "NOOP=$NOOP DEBUG=$DEBUG OUTDIR=$OUTDIR"