HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: "wait" in a script
Operating System - HP-UX
1833237
Members
2530
Online
110051
Solutions
Forums
Categories
Company
Local Language
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
back
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Go to solution
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-07-2002 09:53 AM
05-07-2002 09:53 AM
Hello,
I am trying to write a simple little script
I need to wait for 5-10 seconds before the next
command goes. what is the proper syntax to
put a wait command in a script???
Thank you
hanson
I am trying to write a simple little script
I need to wait for 5-10 seconds before the next
command goes. what is the proper syntax to
put a wait command in a script???
Thank you
hanson
Ross Hanson
Solved! Go to Solution.
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-07-2002 09:55 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-07-2002 09:59 AM
05-07-2002 09:59 AM
Re: "wait" in a script
Hi:
#!/usr/bin/sh
echo "waiting for 10 seconds..."
sleep 10
echo "all done!"
exit 0
...or to wait for a background task (job) to complete:
#!/usr/bin/sh
sleep 10&
PID=$!
echo "...waiting for background task..."
wait $PID
echo "all done!"
exit 0
Regards!
...JRF...
#!/usr/bin/sh
echo "waiting for 10 seconds..."
sleep 10
echo "all done!"
exit 0
...or to wait for a background task (job) to complete:
#!/usr/bin/sh
sleep 10&
PID=$!
echo "...waiting for background task..."
wait $PID
echo "all done!"
exit 0
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-07-2002 10:03 AM
05-07-2002 10:03 AM
Re: "wait" in a script
Hi Ross,
"sleep 10" is how to "pause" execution of a script for 10 seconds.
If you want to run several commands concurrently and wait for them to finish before doing something else, use "wait". For example:
command1 &
command2 &
command3 &
wait
command4
This script runs commands 1 - 3 in the background then waits until they all complete before running command4.
Darrell
"sleep 10" is how to "pause" execution of a script for 10 seconds.
If you want to run several commands concurrently and wait for them to finish before doing something else, use "wait". For example:
command1 &
command2 &
command3 &
wait
command4
This script runs commands 1 - 3 in the background then waits until they all complete before running command4.
Darrell
"What, Me Worry?" - Alfred E. Neuman (Mad Magazine)
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Events and news
Customer resources
© Copyright 2025 Hewlett Packard Enterprise Development LP