The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
wait for 5 seconds in shell script gopsman Shell Programming and Scripting 2 08-30-2007 05:47 AM
make directory script malaysoul Shell Programming and Scripting 0 02-11-2007 11:10 AM
Need to execute 2 scripts, wait, execute 2 more wait, till end of file halo98 Shell Programming and Scripting 1 08-01-2006 04:42 PM
Help make script much easier GCTEII Shell Programming and Scripting 2 03-18-2006 10:12 AM
make script cherio High Level Programming 3 11-11-2002 10:06 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 01-21-2004
Blip Blip is offline
Registered User
  
 

Join Date: Jan 2004
Posts: 27
make my script wait

is there a way to make my script wait before doing something without using the "sleep _" command?
  #2 (permalink)  
Old 01-21-2004
oombera's Avatar
oombera oombera is offline Forum Advisor  
Registered User
  
 

Join Date: Aug 2002
Location: Cleveland, OH
Posts: 804
What're you trying to do? If you explain more about "why", then someone may be able to give a better explanation; depending on your circumstances, you could use the "pause" or "wait" commands.

Or put in a "read ANS" which would cause the program to wait until the user hits ENTER before continuing on to the next line in the script... alternatively, see the following thread for a way to have the user be able to hit any key (not just ENTER) and have the script continue on to the next line after the "read" command.

making a .sh wait for user input

Last edited by oombera; 01-21-2004 at 05:03 PM..
  #3 (permalink)  
Old 01-22-2004
Kelam_Magnus's Avatar
Kelam_Magnus Kelam_Magnus is offline Forum Advisor  
Registered User
  
 

Join Date: Aug 2001
Location: DFW McKinney, TX,
Posts: 1,069
Also, it would help to know what language you are using...and it would be nice to see a snippet of your script and an explanation of what you are trying to do with it.

And maybe what your OS is would be good as well, just in case there are any default shell methods that would work depending on your shell and the language you wrote the script in.
  #4 (permalink)  
Old 01-22-2004
fpmurphy's Avatar
fpmurphy fpmurphy is offline Forum Staff  
Moderator
  
 

Join Date: Dec 2003
Location: Florida
Posts: 1,917
Many shells, including ksh and bash, have a wait shell builtin
that can be used to wait for specific or previous processes
to finish e.g.

wait
wait <PID>


- Finnbarr
  #5 (permalink)  
Old 01-23-2004
photon's Avatar
photon photon is offline
Registered User
  
 

Join Date: Jul 2002
Posts: 162
The best example to give of wait() and notify() is the dining philosophers problem.

Look it up. It is in most operating system books or search google for specific programming
language details.

Otherwise, tell us your programming language and usage. I am sure we could give you an example.

The only reason to use sleep() is if you wanted to delay something for some reason. For instance the frames in a moving picture.
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 11:05 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0