From 9bd8cdf2ecc2b60f873b393122b19985cbc4587c Mon Sep 17 00:00:00 2001 From: Jasper Ras Date: Mon, 2 Jun 2025 12:15:47 +0200 Subject: vault backup: 2025-06-02 12:15:47 --- Setting traps.md | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 Setting traps.md (limited to 'Setting traps.md') 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 -- cgit v1.2.3