Re: Sleeping in a shell
On Mon, Sep 13, 1999 at 07:59:35PM +0200, Marcin Owsiany wrote:
> Does anybody of you guys know a way to sleep for an amount of time less than
> a second in a shell (bash/sh) script?
> sleep refuses arguments like: 0.5 0,5 1/2
> Maybe there is a nice perl command to do this?
> I really don't feel like writing a my_sleep.c ...
This is from man perlfunc:
For delays of finer granularity than one second,
you may use Perl's syscall() interface to access
setitimer(2) if your system supports it, or else
see the select() entry elsewhere in this document
. It is usually a mistake to intermix alarm() and
You can effect a sleep of 250 milliseconds this
select(undef, undef, undef, 0.25);
Of course, the overheard of loading perl for a sleep might not be worth it,
unless you are willing to rewrite the script in perl. (Not a bad idea ;) (as
in, it might take longer than a second to load up perl.. :)
probably my_sleep.c is the way to do it, and with this help from the
perldocs, I hope it isn't too hard for you to do. :)
Seth Arnold | http://www.willamette.edu/~sarnold/
Hate spam? See http://maps.vix.com/rbl/ for help
Hi! I'm a .signature virus! Copy me into
your ~/.signature to help me spread!