2 .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for
3 .\" permission to reproduce portions of its copyrighted documentation.
4 .\" Original documentation from The Open Group can be obtained online at
5 .\" http://www.opengroup.org/bookstore/.
7 .\" The Institute of Electrical and Electronics Engineers and The Open
8 .\" Group, have given us permission to reprint portions of their
11 .\" In the following statement, the phrase ``this text'' refers to portions
12 .\" of the system documentation.
14 .\" Portions of this text are reprinted and reproduced in electronic form
15 .\" in the SunOS Reference Manual, from IEEE Std 1003.1, 2004 Edition,
16 .\" Standard for Information Technology -- Portable Operating System
17 .\" Interface (POSIX), The Open Group Base Specifications Issue 6,
18 .\" Copyright (C) 2001-2004 by the Institute of Electrical and Electronics
19 .\" Engineers, Inc and The Open Group. In the event of any discrepancy
20 .\" between these versions and the original IEEE and The Open Group
21 .\" Standard, the original IEEE and The Open Group Standard is the referee
22 .\" document. The original Standard can be obtained online at
23 .\" http://www.opengroup.org/unix/online.html.
25 .\" This notice shall appear on any product containing this material.
27 .\" The contents of this file are subject to the terms of the
28 .\" Common Development and Distribution License (the "License").
29 .\" You may not use this file except in compliance with the License.
31 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
32 .\" or http://www.opensolaris.org/os/licensing.
33 .\" See the License for the specific language governing permissions
34 .\" and limitations under the License.
36 .\" When distributing Covered Code, include this CDDL HEADER in each
37 .\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
38 .\" If applicable, add the following below this CDDL HEADER, with the
39 .\" fields enclosed by brackets "[]" replaced with your own identifying
40 .\" information: Portions Copyright [yyyy] [name of copyright owner]
43 .\" Copyright 1989 AT&T
44 .\" Portions Copyright (c) 1992, X/Open Company Limited All Rights Reserved
45 .\" Portions Copyright (c) 1982-2007 AT&T Knowledge Ventures
46 .\" Copyright (c) 2007, Sun Microsystems, Inc. All Rights Reserved Portions
48 .TH SLEEP 1 "May 13, 2017"
50 sleep \- suspend execution for an interval
55 \fB/usr/bin/sleep\fR \fIseconds\fR
61 \fBsleep\fR \fIseconds\fR
66 \fBsleep\fR suspends execution for at least the time in seconds specified by
67 \fIseconds\fR or until a \fBSIGALRM\fR signal is received. The \fIseconds\fR
68 operand can be specified as a floating point number but the actual granularity
69 normally depends on the underlying system.
73 The following operands are supported for \fB/usr/bin/sleep\fR and \fBksh93\fR's
74 \fBsleep\fR built-in command:
81 A non-negative floating-point number specifying the number of seconds for which
82 to suspend execution. The floating-point number may be specified in all formats
83 required by C99/XPG6, including constants such as "Inf" or "infinity".
88 The following operands are supported:
95 Specify \fItime\fR in seconds as a floating point number. The actual
96 granularity depends on the underlying system, normally around 1 millisecond.
101 \fBExample 1 \fRSuspending Command Execution
104 The following example executes a command after a certain amount of time:
109 example% \fB(sleep 105; \fIcommand\fR)&\fR
115 \fBExample 2 \fRExecuting a Command Every So Often
118 The following example executes a command every so often:
123 example% \fBwhile true
133 \fBExample 3 \fRSuspend command execution forever (or until a \fBSIGALRM\fR
144 \fBExample 4 \fRSuspending command execution for 0.5 seconds
147 Suspending command execution for 0.5 seconds using an alternative
148 floating-point representation for the value "0.5"
153 example% printf "%a\en" 0.5
154 0x1.0000000000000000000000000000p-01
162 example% sleep 0x1.0000000000000000000000000000p-01
167 .SH ENVIRONMENT VARIABLES
169 See \fBenviron\fR(5) for descriptions of the following environment variables
170 that affect the execution of \fBsleep\fR: \fBLANG\fR, \fBLC_ALL\fR,
171 \fBLC_CTYPE\fR, \fBLC_MESSAGES\fR, and \fBNLSPATH\fR.
174 The following exit values are returned:
181 The execution was successfully suspended for at least \fItime\fR seconds, or a
182 \fBSIGALRM\fR signal was received (see NOTES).
191 An error has occurred.
196 See \fBattributes\fR(5) for descriptions of the following attributes:
202 ATTRIBUTE TYPE ATTRIBUTE VALUE
204 Interface Stability Committed
206 Standard See \fBstandards\fR(5).
214 ATTRIBUTE TYPE ATTRIBUTE VALUE
216 Interface Stability Uncommitted
221 \fBksh93\fR(1), \fBwait\fR(1), \fBalarm\fR(2), \fBsleep\fR(3C),
222 \fBattributes\fR(5), \fBenviron\fR(5), \fBstandards\fR(5)
225 If the \fBsleep\fR utility receives a \fBSIGALRM\fR signal, one of the
226 following actions is taken:
231 Terminate normally with a zero exit status.
237 Effectively ignore the signal.
241 The \fBsleep\fR utility takes the standard action for all other signals.
244 The behavior for input values such as "NaN" (not-a-number) or negative values