fix set -e
This commit is contained in:
17
download.sh
17
download.sh
@ -317,11 +317,20 @@ done
|
|||||||
(( DEBUG )) && { log "Debug mode enabled"; set -x; }
|
(( DEBUG )) && { log "Debug mode enabled"; set -x; }
|
||||||
|
|
||||||
# Enforce mutual exclusivity between -c, -p, -f
|
# 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
|
count=0
|
||||||
[[ -n $collection ]] && ((count++))
|
if [[ -n $collection ]]; then
|
||||||
[[ -n $post ]] && ((count++))
|
((count++))
|
||||||
[[ -n $file ]] && ((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)"
|
log "Arg summary: collection='${collection:-}' post='${post:-}' file='${file:-}' (count=$count)"
|
||||||
if (( count != 1 )); then
|
if (( count != 1 )); then
|
||||||
|
|||||||
Reference in New Issue
Block a user