timed scripts
bash provides a few built in internal variables which can be very useful. Today I discovered SECONDS
:
The number of seconds the script has been running.
For me, this came in handy when I wanted to run a one-time script for 15 minutes, then bail.
Here’s a example running one for 60 seconds:
SECONDS
is available in terminal sessions as well, and contains the number of seconds since the session started.