aboutsummaryrefslogtreecommitdiff
path: root/content/notes
diff options
context:
space:
mode:
authorMitja Felicijan <mitja.felicijan@gmail.com>2023-05-28 17:57:46 +0200
committerMitja Felicijan <mitja.felicijan@gmail.com>2023-05-28 17:57:46 +0200
commit048c9b2a7d0ddf252667fa7cfff87cbf4acfd48a (patch)
tree90e48a3fc5c272f92c0172f2199ecf61d5b01205 /content/notes
parentad2f788d90e90b734dab978ff58f4a65e3f1fdcc (diff)
downloadmitjafelicijan.com-048c9b2a7d0ddf252667fa7cfff87cbf4acfd48a.tar.gz
Note: Measure time took
Diffstat (limited to 'content/notes')
-rw-r--r--content/notes/easy-time-took-in-bash.md23
1 files changed, 23 insertions, 0 deletions
diff --git a/content/notes/easy-time-took-in-bash.md b/content/notes/easy-time-took-in-bash.md
new file mode 100644
index 0000000..c97f0f1
--- /dev/null
+++ b/content/notes/easy-time-took-in-bash.md
@@ -0,0 +1,23 @@
1---
2title: "Easy meassure time took in a bash script"
3url: easy-time-took-in-bash.html
4date: 2023-05-28T17:53:20+02:00
5type: notes
6draft: false
7tags: [bash]
8---
9
10In 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.
11
12```bash
13#!/bin/bash
14
15# Reset the timer to zero.
16SECONDS=0
17
18# Do something.
19sleep 5
20
21# Print the time elapsed.
22echo "Time taken: $SECONDS seconds"
23```