fix: clear EXIT trap before return to avoid unbound $tmpdir under set -u
All checks were successful
All checks were successful
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
c287ec0626
commit
cb8c131bc4
1 changed files with 5 additions and 0 deletions
|
|
@ -128,4 +128,9 @@ backup_create() {
|
||||||
local size
|
local size
|
||||||
size=$(du -h "$outfile" | cut -f1)
|
size=$(du -h "$outfile" | cut -f1)
|
||||||
echo "=== Backup complete: ${outfile} (${size}) ==="
|
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"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue