← All tips Bash: trap cleanup on exit bashscripts Ensure temp files are removed even on failure. tmp=$(mktemp) trap 'rm -f "$tmp"' EXIT