diff --git a/lib/backup.sh b/lib/backup.sh index 8b4c858..8d7a827 100644 --- a/lib/backup.sh +++ b/lib/backup.sh @@ -128,4 +128,9 @@ backup_create() { local size size=$(du -h "$outfile" | cut -f1) echo "=== Backup complete: ${outfile} (${size}) ===" + + # Clean up before returning — the EXIT trap references the local $tmpdir + # which goes out of scope after return, causing 'unbound variable' under set -u. + trap - EXIT + rm -rf "$tmpdir" }