Trap
lastmod 2023-03-19created 2019-04-053 edits
Provides a way for a script or shell to intercept interrupts and perform some action within the script.
Pseudo-signals
| EXIT | Raised when the shell exits. ( also applies to subshells ) |
| ERR | Raised when a command returns a non-zero exit status. |
| DEBUG | Raised every time before a command runs. |
| RETURN | Raised when returning from a function or from a sourced file. |