sleep
This is the shell equivalent of a wait loop. It pauses for a
specified number of seconds, doing nothing. It can be useful
for timing or in processes running in the background,
checking for a specific event every so often (polling),
as in Example 29-6.sleep 3 # Pauses 3 seconds.
The sleep command defaults to
seconds, but minute, hours, or days may also be specified.sleep 3 h # Pauses 3 hours!
The watch command may
be a better choice than sleep for running
commands at timed intervals.usleep
Microsleep (the "u"
may be read as the Greek "mu", or micro-
prefix). This is the same as sleep,
above, but "sleeps" in microsecond
intervals. It can be used for fine-grain timing, or for
polling an ongoing process at very frequent intervals.
usleep 30 # Pauses 30 microseconds.
This command is part of the Red Hat initscripts /
rc-scripts package.
The usleep command does not
provide particularly accurate timing, and is therefore
unsuitable for critical timing loops.