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
Execute not blocking async shell command in C#
Uninstall Ollama from a Linux box
Currated list of Vim ALE linters
Install Plan9port on Linuxplan9
Embedding resources into binary with Cc
Sane default for Dungeon Crawl Stone Soup Online editiondcss
Cache busting in Hugo
Development environments with Nix
Fix bootloader not being written in Plan9plan9
Making cgit look nicer
Extend Lua with custom C functions using Clangc
Simple presentations with Markdown
AWS EB PyYAML fix
Bulk thumbnails
Take a screenshot in Plan9plan9