summaryrefslogtreecommitdiff
path: root/Setting traps.md
diff options
context:
space:
mode:
Diffstat (limited to 'Setting traps.md')
-rw-r--r--Setting traps.md10
1 files changed, 10 insertions, 0 deletions
diff --git a/Setting traps.md b/Setting traps.md
new file mode 100644
index 0000000..cd36e80
--- /dev/null
+++ b/Setting traps.md
@@ -0,0 +1,10 @@
+---
+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 \ No newline at end of file