summaryrefslogtreecommitdiff
path: root/Setting traps.md
blob: b3bc8f3b4b5a55c2027e89b66fc3f239ad943e5a (plain)
1
2
3
4
5
6
7
8
9
10
11
---
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