I want to execute something in a linux shell under a few different conditions, and be able to output the execution time of each execution.
I know I could write a perl or python script that would do this, but is there a way I can do it in the shell? (which happens to be bash)
Use the built-in
time
keyword:Example:
The way is
output is >>
For a line-by-line delta measurement, try gnomon.
You can also use the
--high
and/or--medium
options to specify a length threshold in seconds, over which gnomon will highlight the timestamp in red or yellow. And you can do a few other things, too.You can use
time
and subshell()
:Or in same shell
{}
: