Results 1 to 8 of 8
Hi guys I'm new to scripting in Linux but I need a help urgently. I need to know how to delay a command execution? for example a delay of 10 ...
- 09-19-2009 #1Just Joined!
- Join Date
- Jan 2009
- Posts
- 11
Scripting
Hi guys I'm new to scripting in Linux but I need a help urgently. I need to know how to delay a command execution? for example a delay of 10 seconds before a command line is executed! I need this help very urgently.. I would appreciate any notes or even commands that would help me

Thanks guys
- 09-19-2009 #2Linux Newbie
- Join Date
- Nov 2007
- Location
- Planet Earth
- Posts
- 152
The sleep command, e.g.:
$ sleep 5
delays 5 seconds the next sentence.EOF
- 09-19-2009 #3Just Joined!
- Join Date
- Jan 2009
- Posts
- 11
does it work with .sh files?
- 09-19-2009 #4
- 09-23-2009 #5Just Joined!
- Join Date
- Jan 2009
- Posts
- 11
I don't know why am i getting error in this message. can anyone please clear me out.
thanks guys
#!/bin/bash
for stress in `seq 10`
do
echo "Running the stress test now"
read -p "Entering S3 mode now. Press ENTER once ready"
echo -n "mem">/sys/power/state
echo "Wake up from S3 is successful"
$sleep 10
read -p "Entering S1 mode now. Press ENTER once ready"
echo -n "standby">/sys/power/state
echo "Wake up from S1 is successful"
echo "Looping back"
done
exit 0
- 09-23-2009 #6Just Joined!
- Join Date
- Jan 2009
- Posts
- 11
I am getting the error below. Guys i need this help very urgently.. thanks
: command not foundline 2:
: command not foundline 4: do
Running the stress test now
Entering S3 mode now. Press ENTER once ready
: No such file or directory/sys/power/state
Wake up from S3 is successful
: command not foundline 9: 10
Entering S1 mode now. Press ENTER once ready
: No such file or directory /sys/power/state
Wake up from S1 is successful
Looping back
: command not foundline 14: done
: numeric argument required exit: 0
- 09-23-2009 #7Just Joined!
- Join Date
- Jan 2009
- Posts
- 11
Guys.. after checking here is the code. Could you guys check whether there is any problem with my script as the execution of the command has some problem.
#!/bin/bash
#for stress test in `seq 10`
do
echo "Running the stress test now";
read -p "Entering S3 mode now. Press ENTER once ready";
echo -n "mem">/sys/power/state;
echo "Wake up from S3 is successful";
sleep 10;
read -p "Entering S1 mode now. Press ENTER once ready";
echo -n "standby">/sys/power/state;
echo "Wake up from S1 is successful";
echo "Looping back";
done;
exit 0;
thank you guys for the help
- 09-24-2009 #8Just Joined!
- Join Date
- Mar 2008
- Location
- Chennai, India
- Posts
- 26
Is this a homework??


Reply With Quote
