Search

Keeping track of running time of script

if we want to track the time a script takes to run, we can make use of the inbuilt BASH variable SECONDS.

The value of SECONDS is always the time for which the script, in which it is called, is executing. For e.g.



Output :



Thus if we print the value of the variable SECONDS right at the end of the script we can get the time that the script took to complete.

No comments:

Post a Comment