July 2013
M T W T F S S
1234567
891011121314
15161718192021
22232425262728
293031  

Categories

July 2013
M T W T F S S
1234567
891011121314
15161718192021
22232425262728
293031  

Elapsed Time for Shell Scripts

lot of times you want to calculate the time it takes for a part of a shell script to run. Here is one of the ways you can do this:

T1=$(date +%s) # Do something here T2=$(date +%s) diffsec=”$(expr $T2 – $T1)” echo | awk -v D=$diffsec ‘{printf “Elapsed time: %02d:%02d:%02d\n”,D/(60*60),D%(60*60)/60,D%60}’

This will tell you […]