Lifecycletrap — Cleanup on Exit
All courses

Always leave the campsite cleaner

trap handler EXIT runs on normal exit, error, or signal (depending on signal). Essential for deleting temp files and releasing locks.

Best practice: Pair traps with mktemp for safe temp files under /tmp.

Output
Press Run to execute your code.