Hello,
How can i find the execution time of a script.
help me .

im using the following script
echo "Start of script"
echo "SECONDS=$SECONDS"
echo "Sleep $2"
sleep $2
echo "SECONDS=$SECONDS"
echo "Sleep $2"
sleep $2
echo "SECONDS=$SECONDS"
echo "End Of script"
echo "SECONDS=$SECONDS"
actually i need to pass the script an argument to find the execution time

I am not really following you. If you just want to know how long the script runs for in seconds. you can just place this line last in the script

#!/bin/sh
echo $SECONDS  #this line will echo 0, beciase this is the very start of the script
sleep 10
sleep 1
echo $SECONDS  #this final line echos the total execution time of the script(in seconds)

Hello ,
Thanks for the reply,
I can explain it to you in this way,
the script should execute the specified script given as argument 1 ($1)
for the specified number of seconds argument 2 and must sleep for specified number of seconds given as argument 2 and must continue the cycle until argument 1 is executed.
i mean to say that
run script for $2 seconds
sleep $2
and again continue $1
until script get executed

and this must continue until argument 1 is completed.
Can you plz give me any idea for this script

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.