Sleep under one second | Unix Linux Forums | Shell Programming and Scripting

  Go Back    


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

Sleep under one second

Shell Programming and Scripting


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 07-19-2002
Scoogie Scoogie is offline
Registered User
 
Join Date: Nov 2001
Last Activity: 19 July 2002, 1:03 PM EDT
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Data Sleep under one second

If I want a script to sleep for less than a second, would I use a decimal? In other words, if I wanted my script to sleep for 1/4 of a second, would I say, SLEEP .25 ??
Sponsored Links
    #2  
Old 07-19-2002
edog edog is offline
Registered User
 
Join Date: Sep 2001
Last Activity: 29 July 2004, 10:17 AM EDT
Location: Green Bay, WI
Posts: 66
Thanks: 0
Thanked 0 Times in 0 Posts
I don't think you can use the sleep command for less than 1 second, from the man pages:

The sleep command suspends execution of a process for at least the interval specified by the Seconds parameter. The amount of time specified in the Seconds parameter can range from 1 to MAXINT (2,147,483,647) seconds.
Sponsored Links
    #3  
Old 07-19-2002
Perderabo's Avatar
Perderabo Perderabo is offline Forum Staff  
Unix Daemon (Administrator Emeritus)
 
Join Date: Aug 2001
Last Activity: 18 December 2014, 2:02 PM EST
Location: Ashburn, Virginia
Posts: 9,930
Thanks: 64
Thanked 440 Times in 261 Posts
See this post for one solution.
    #4  
Old 07-31-2002
kjd kjd is offline
Registered User
 
Join Date: Jul 2002
Last Activity: 4 August 2002, 11:48 PM EDT
Location: TX, USA
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
GNU sleep / perl

GNU sleep 2.0a and up support floating-point numbers (i.e. sleep 0.25).

If your script is in Perl, you can use select() to time out in fractions of seconds:

select(undef,undef,undef,0.25); # sleep 1/4 second
Sponsored Links
    #5  
Old 08-14-2002
aaditya aaditya is offline
Registered User
 
Join Date: Aug 2002
Last Activity: 9 December 2002, 12:11 AM EST
Location: Ahmedabad
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
u can use the command "usleep".

u will have to specify the number in microseconds.

for e.g., if u have to sleep for 0.25 seconds.

then specify,

usleep 250000

aaditya
Sponsored Links
    #6  
Old 08-14-2002
Nisha Nisha is offline
Registered User
 
Join Date: Jun 2002
Last Activity: 16 August 2004, 4:51 AM EDT
Location: Chennai, India
Posts: 110
Thanks: 0
Thanked 1 Time in 1 Post
There is a command

delay_output which pauses the production of output for a specified number of milli seconds.

Is this what u want????

-Nisha
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Wrapping 'sleep' with my 'resleep' function (Resettable sleep) deckard Shell Programming and Scripting 5 09-28-2009 02:58 PM
sleep working meetbhattu UNIX for Advanced & Expert Users 2 10-29-2007 06:05 PM
Sleep less than 1 second bjorno UNIX for Dummies Questions & Answers 9 08-25-2005 04:55 AM
sleep Anna UNIX for Dummies Questions & Answers 5 07-11-2001 12:52 AM



All times are GMT -4. The time now is 02:32 AM.