SLEEP(1) General Commands Manual SLEEP(1)

sleepsuspend execution for an interval

sleep time

The sleep utility shall suspend execution for at least the integral number of seconds specified by the time operand.

None.

The following operands shall be supported by the implementation:

time

A nonnegative decimal integer specifying the number of seconds for which to suspend execution.

None.

None.

The following environment variables shall affect the execution of sleep:

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.

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_.

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).

This variable shall determine the language in which messages should be written.

If the sleep utility receives a SIGALRM signal, one of the following actions shall be taken:

  1. Terminate normally with a zero exit status
  2. Effectively ignore the signal
  3. 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.

None.

Used only for diagnostic messages.

None.

None.

The sleep utility shall exit with one of the following values:

The execution was successfully suspended for at least time seconds, or a SIGALRM signal was received (see ASYNCHRONOUS EVENTS ).

An error occurred.

Default.

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.

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.

September 1991 posix.fail