--- tags: - bash --- With traps you can configure a function that is run upon a specific signal or when the script fails or exits normally. `trap fn ERR` > when an error occurrs `trap fn EXIT` > any exit, also errors and interrupts `trap fn SIGINT` > when interrupted `trap fn ERR SIGINT` > either an interrupt or error occurred