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
Making cgit look nicer
Drawing Pixels in Plan9plan9
Currated list of Vim ALE linters
Compile drawterm on Fedora 38plan9
Cronjobs on Github with Github Actions
Extract lines from a file with sed
Development environments with Nix
Change Alt key to Win key under Xfce4
Embedding resources into binary with Cc
Easy measure time took in a bash script
AWS EB PyYAML fix
Fix bootloader not being written in Plan9plan9
Set color temperature of displays on i3
Push to multiple origins at once in Git
Display xterm color palette