diff --git a/backup.nix b/backup.nix index bd5cc21..9909f46 100644 --- a/backup.nix +++ b/backup.nix @@ -14,8 +14,7 @@ let exit_code=0; for i in ''${BACKUP_HELPER_DIRS//,/ }; do echo "Starting backup of $i"; - output=$(restic backup "$i"); - if [ "$?" -ne 0 ]; then + if ! output=$(restic backup "$i"); then exit_code="$?"; echo "Backup of $i failed with exit code $?:" echo "$output"