From cd6644ea4ddc78597934ab0ef5ba50e3c3daa927 Mon Sep 17 00:00:00 2001 From: Mitja Felicijan Date: Sat, 8 Jul 2023 23:25:41 +0200 Subject: Moved to a simpler SSG --- public/easy-time-took-in-bash.html | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100755 public/easy-time-took-in-bash.html (limited to 'public/easy-time-took-in-bash.html') diff --git a/public/easy-time-took-in-bash.html b/public/easy-time-took-in-bash.html new file mode 100755 index 0000000..e46ab6c --- /dev/null +++ b/public/easy-time-took-in-bash.html @@ -0,0 +1,23 @@ +Easy measure time took in a bash script

Easy measure time took in a bash script

May 28, 2023

In Bash, the $SECONDS variable is a special variable that automatically keeps +track of the number of seconds since the current shell or script started +executing. It starts counting from the moment the script begins running.

#!/bin/bash
+
+# Reset the timer to zero.
+SECONDS=0
+
+# Do something.
+sleep 5
+
+# Print the time elapsed.
+echo "Time taken: $SECONDS seconds"
+
\ No newline at end of file -- cgit v1.2.3