NAME
sleep — suspend
execution for an interval
SYNOPSIS
sleep |
time |
DESCRIPTION
The sleep utility shall suspend execution
for at least the integral number of seconds specified by the time
operand.
OPTIONS
None.
OPERANDS
The following operands shall be supported by the implementation:
- time
-
A nonnegative decimal integer specifying the number of seconds for which to suspend execution.
STANDARD INPUT
None.
INPUT FILES
None.
ENVIRONMENT VARIABLES
The following environment variables shall affect the execution of
sleep:
LANG-
This variable shall determine the locale to use for the locale categories when both LC_ALL and the corresponding environment variable (beginning with LC_ ) do not specify a locale. See 2.6.
LC_ALL-
This variable shall determine the locale to be used to override any values for locale categories specified by the settings of LANG or any environment variables beginning with LC_.
LC_CTYPE-
This variable shall determine the locale for the interpretation of sequences of bytes of text data as characters (e.g., single- versus multibyte characters in arguments).
LC_MESSAGES-
This variable shall determine the language in which messages should be written.
ASYNCHRONOUS EVENTS
If the sleep utility receives a
SIGALRM signal, one of the following actions shall be
taken:
- Terminate normally with a zero exit status
- Effectively ignore the signal
- Provide the default behavior for signals described in 2.11.5.4. This could include terminating with a nonzero exit status.
The sleep utility shall take the standard
action for all other signals; see 2.11.5.4.
STANDARD OUTPUT
None.
STANDARD ERROR
Used only for diagnostic messages.
OUTPUT FILES
None.
EXTENDED DESCRIPTION
None.
EXIT STATUS
The sleep utility shall exit with one of
the following values:
- 0
-
The execution was successfully suspended for at least time seconds, or a SIGALRM signal was received (see ASYNCHRONOUS EVENTS ).
- >0
-
An error occurred.
CONSEQUENCES OF ERRORS
Default.
RATIONALE
EXAMPLES
The exit status is allowed to be zero when
sleep is interrupted by the
SIGALRM signal, because most implementations of this
utility rely on the arrival of that signal to notify them that the requested
finishing time has been successfully attained. Such implementations thus do
not distinguish this situation from the successful completion case. Other
implementations are allowed to catch the signal and go back to
sleep until the requested time expires or provide
the normal signal termination procedures.
HISTORY OF DECISIONS MADE
As with all other utilities that take integral operands and do not
specify subranges of allowed values, sleep is
required by this standard to deal with time requests of up to 2 147 483 647
seconds. This may mean that some implementations will have to make multiple
calls to the underlying operating system’s delay mechanism if its
argument range is less than this.