Easy measure time took in a bash script
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"