shell script to get the time difference

Nov-22nd-2010

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 !!!

Mega World News Facebook Twitter Myspace Friendfeed Technorati del.icio.us Digg Google Yahoo Buzz StumbleUpon Weekend Joy

Add A Comment

*