Sunday 14 December 2008

Execute time of a script

How can I calculate approx. execute time of a script along with gzipping the output file?

I have given the inputfile as a commandline argument to my script.

put these lines in a file like time.sh and run as shown.

$ ./time.sh inputfile

#!/bin/sh
current=`date +%s`
cat $1 | ./run.sh > output_`basename $1`
gzip -9 output_`basename $1`
end=`date +%s`
echo "time consumed to execute : `expr $end - $current` " | tee executetime

No comments:

Post a Comment

Tweets by @sriramperumalla