What does trap cleanup EXIT accomplish in a Bash script?
trap cleanup EXIT
It runs cleanup only when every command succeeds.
It calls cleanup immediately and then disables all later commands.
cleanup
It registers cleanup to run when the shell exits, whether the script finishes normally or due to many error paths.
It monitors a file literally named EXIT for changes.
EXIT