1sleep(1) User Commands sleep(1)
2
3
4
6 sleep - suspend execution for an interval
7
9 /usr/bin/sleep
10 /usr/bin/sleep seconds
11
12
13 ksh93
14 sleep seconds
15
16
18 sleep suspends execution for at least the time in seconds specified by
19 seconds or until a SIGALRM signal is received. The seconds operand can
20 be specified as a floating point number but the actual granularity nor‐
21 mally depends on the underlying system.
22
24 /usr/bin/sleep
25 The following operands are supported for /usr/bin/sleep and ksh93's
26 sleep built-in command:
27
28 seconds A non-negative floating-point number specifying the number
29 of seconds for which to suspend execution. The floating-
30 point number may be specified in all formats required by
31 C99/XPG6, including constants such as "Inf" or "infinite".
32
33
34 ksh93
35 The following operands are supported:
36
37 time Specify time in seconds as a floating point number. The actual
38 granularity depends on the underlying system, normally around 1
39 millisecond.
40
41
43 Example 1 Suspending Command Execution
44
45
46 The following example executes a command after a certain amount of
47 time:
48
49
50 example% (sleep 105; command)&
51
52
53
54 Example 2 Executing a Command Every So Often
55
56
57 The following example executes a command every so often:
58
59
60 example% while true
61 do
62 command
63 sleep 37
64 done
65
66
67
68 Example 3 Suspend command execution forever (or until a SIGALRM signal
69 is received)
70
71 example% sleep Inf
72
73
74
75 Example 4 Suspending command execution for 0.5 seconds
76
77
78 Suspending command execution for 0.5 seconds using an alternative
79 floating-point representation for the value "0.5"
80
81
82 example% printf "%a0 0.5
83 0x1.0000000000000000000000000000p-01
84
85
86
87 example% sleep 0x1.0000000000000000000000000000p-01
88
89
90
92 See environ(5) for descriptions of the following environment variables
93 that affect the execution of sleep: LANG, LC_ALL, LC_CTYPE, LC_MES‐
94 SAGES, and NLSPATH.
95
97 The following exit values are returned:
98
99 0 The execution was successfully suspended for at least time sec‐
100 onds, or a SIGALRM signal was received (see NOTES).
101
102
103 >0 An error has occurred.
104
105
107 See attributes(5) for descriptions of the following attributes:
108
109 /usr/bin/sleep
110 ┌─────────────────────────────┬─────────────────────────────┐
111 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
112 ├─────────────────────────────┼─────────────────────────────┤
113 │Availability │SUNWcsu │
114 ├─────────────────────────────┼─────────────────────────────┤
115 │Interface Stability │Committed │
116 ├─────────────────────────────┼─────────────────────────────┤
117 │Standard │See standards(5). │
118 └─────────────────────────────┴─────────────────────────────┘
119
120 ksh93
121 ┌─────────────────────────────┬─────────────────────────────┐
122 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
123 ├─────────────────────────────┼─────────────────────────────┤
124 │Availability │SUNWcsu │
125 ├─────────────────────────────┼─────────────────────────────┤
126 │Interface Stability │Uncommitted │
127 └─────────────────────────────┴─────────────────────────────┘
128
130 ksh93(1), wait(1), alarm(2), sleep(3C), wait(3UCB), attributes(5), env‐
131 iron(5), standards(5)
132
134 If the sleep utility receives a SIGALRM signal, one of the following
135 actions is taken:
136
137 o Terminate normally with a zero exit status.
138
139 o Effectively ignore the signal.
140
141
142 The sleep utility takes the standard action for all other signals.
143
144
145 The behavior for input values such as "NaN" (not-a-number) or negative
146 values is undefined.
147
148
149
150SunOS 5.11 20 Nov 2007 sleep(1)