Hacker News new | ask | show | jobs
by alexanderdmitri 3204 days ago
Yeah, SECONDS is great. I just discovered this a few days ago to get a general idea of execution time for each process a script handles:

# At top of script

SECONDS = 0

# script commands

...

# At bottom of script

duration=$SECONDS

echo "$(($duration / 60)) minutes and $(($duration % 60)) seconds elapsed."