2
Contributors
3
Replies
4
Views
12 Years
Discussion Span
Last Post by warangalboy
0

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

0

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)
0

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

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.