fix set -e
This commit is contained in:
14
download.sh
14
download.sh
@ -317,15 +317,13 @@ 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
|
||||||
set -- "$collection" "$post" "$file"
|
# (avoid set -e pitfalls by not looping over empty args)
|
||||||
count=0
|
count=0
|
||||||
for x in "$@"; do
|
[[ -n $collection ]] && ((count++))
|
||||||
if [[ -n $x ]]; then
|
[[ -n $post ]] && ((count++))
|
||||||
((count++))
|
[[ -n $file ]] && ((count++))
|
||||||
fi
|
|
||||||
done
|
log "Arg summary: collection='${collection:-}' post='${post:-}' file='${file:-}' (count=$count)"
|
||||||
# Ensure a zero exit status here to avoid set -e exiting if the last test was false
|
|
||||||
true
|
|
||||||
if (( count != 1 )); then
|
if (( count != 1 )); then
|
||||||
usage
|
usage
|
||||||
die "Options -c, -p och -f kan inte användas samtidigt (exakt en krävs)."
|
die "Options -c, -p och -f kan inte användas samtidigt (exakt en krävs)."
|
||||||
|
|||||||
Reference in New Issue
Block a user