Run a function on interrupt or error
cleanup() {
rm some-temp-file-maybe
# ... other actions
exit 1
}
trap cleanup ERR SIGINTLast updated
cleanup() {
rm some-temp-file-maybe
# ... other actions
exit 1
}
trap cleanup ERR SIGINTLast updated