Hello Everyone,
I wanna share with you about how to compute elapse time in shell script on Linux. This tutorial I made based on my personal experience. The code is shown as the following.
STARTIME=$(date +%s)
for (( i=1; i<=1000000;i++))
do
echo "$i"
done
ENDTIME=$(date +%s)
echo "It takes $(($ENDTIME - $STARTIME)) second to complete this task..." > elapse_time.txt
You can change looping part to be your own code. The result of above code will be stored into elapse_time.txt.
Thank you.