Easy measure time took in a bash script

note, May 28, 2023, on Mitja Felicijan's blog

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"

Other notes

DateTitle
Sending signals to C programsc
Grep to Less that maintain colors
Extending dte editor
Male and female body proportion reference images3d
Drawing Pixels in Plan9plan9
Execute not blocking async shell command in C#
Make B/W SVG charts with matplotlib
Alacritty open links with modifier
Making cgit look nicer
Currated list of Vim ALE linters
Aerial photography of algae spotted on river Sava
Uninstall Ollama from a Linux box
Fix screen tearing on Debian 12 Xorg and i3
Edsger W. Dijkstra Manuscripts ebook
Change permissions of matching files recursively