Shell Script to get time difference or time duration of the process…
Here is your script.
[root@map007 ~]# vim gettime.sh
#!/bin/bash
START=$(date +%s)
# Start your programme
ls -a > /tmp/test.txt
ls -Ra >> /tmp/test.txt
cat /tmp/test.txt
END=$(date +%s)
# Time Difference
DIFF=$(( $END – $START ))
echo “Time Taken :- $DIFF sec.”
[root@map007 ~]# sh gettime.sh
Time Taken :- 2 sec.
===========================================================================
Enjoy Linux !!!












