From 59f0dc16bc5a308ae11a217a63a4665d1d8e36ed Mon Sep 17 00:00:00 2001 From: Ze'ev Schurmann Date: Tue, 12 Dec 2023 22:38:02 +0200 Subject: [PATCH] Added the example script. --- example.sh | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 example.sh diff --git a/example.sh b/example.sh new file mode 100644 index 0000000..e2850fa --- /dev/null +++ b/example.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +SECONDS=0 + +trap cleanexit 0 +trap breakexit 2 +trap commandexit 17 + +function cleanexit { + echo "$SECONDS, Finished!" >> time.log + exit 0 +} + +function breakexit { + echo "$SECONDS, CTRL+C" >> time.log + exit 1 +} + +function commandexit { + echo "$SECONDS, $(fc -ln -1), $?" >> time.log +} + +##BASH SCRIPT GOES HERE