sleep - suspend execution for an interval
sleep time
The sleep utility will suspend execution for at least the integral number of seconds specified by the time operand.
None.
The following operands are supported:
- time
- A non-negative decimal integer specifying the number of seconds for which to suspend execution.
Not used.
None.
The following environment variables affect the execution of sleep:
- LANG
- Provide a default value for the internationalisation variables that are unset or null. If LANG is unset or null, the corresponding value from the implementation-dependent default locale will be used. If any of the internationalisation variables contains an invalid setting, the utility will behave as if none of the variables had been defined.
- LC_ALL
- If set to a non-empty string value, override the values of all the other internationalisation variables.
- LC_CTYPE
- Determine the locale for the interpretation of sequences of bytes of text data as characters (for example, single- as opposed to multi-byte characters in arguments).
- LC_MESSAGES
- Determine the locale that should be used to affect the format and contents of diagnostic messages written to standard error.
- NLSPATH
- Determine the location of message catalogues for the processing of LC_MESSAGES .
If the sleep utility receives a SIGALRM signal, one of the following actions will be taken:
- Terminate normally with a zero exit status.
- Effectively ignore the signal.
- Provide the default behaviour for signals described in the ASYNCHRONOUS EVENTS section of Utility Description Defaults
. This could include terminating with a non-zero exit status.
The sleep utility will take the standard action for all other signals.
Not used.
Used only for diagnostic messages.
None.
None.
The following exit values are returned:
- 0
- The execution was successfully suspended for at least time seconds, or a SIGALRM signal was received (see the ASYNCHRONOUS EVENTS section).
- >0
- An error occurred.
Default.
None.
The sleep utility can be used to execute a command after a certain amount of time, as in:(sleep 105; command) &
or to execute a command every so often, as in:
while true do command sleep 37 done
None.
wait, the XSH specification description of alarm(), sleep().