Print this page
12745 man page typos
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/man/man1/wait.1
+++ new/usr/src/man/man1/wait.1
1 1 .\"
2 2 .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for
3 3 .\" permission to reproduce portions of its copyrighted documentation.
4 4 .\" Original documentation from The Open Group can be obtained online at
5 5 .\" http://www.opengroup.org/bookstore/.
6 6 .\"
7 7 .\" The Institute of Electrical and Electronics Engineers and The Open
8 8 .\" Group, have given us permission to reprint portions of their
9 9 .\" documentation.
10 10 .\"
11 11 .\" In the following statement, the phrase ``this text'' refers to portions
12 12 .\" of the system documentation.
13 13 .\"
14 14 .\" Portions of this text are reprinted and reproduced in electronic form
15 15 .\" in the SunOS Reference Manual, from IEEE Std 1003.1, 2004 Edition,
16 16 .\" Standard for Information Technology -- Portable Operating System
17 17 .\" Interface (POSIX), The Open Group Base Specifications Issue 6,
18 18 .\" Copyright (C) 2001-2004 by the Institute of Electrical and Electronics
19 19 .\" Engineers, Inc and The Open Group. In the event of any discrepancy
20 20 .\" between these versions and the original IEEE and The Open Group
21 21 .\" Standard, the original IEEE and The Open Group Standard is the referee
22 22 .\" document. The original Standard can be obtained online at
23 23 .\" http://www.opengroup.org/unix/online.html.
24 24 .\"
25 25 .\" This notice shall appear on any product containing this material.
26 26 .\"
27 27 .\" The contents of this file are subject to the terms of the
28 28 .\" Common Development and Distribution License (the "License").
29 29 .\" You may not use this file except in compliance with the License.
30 30 .\"
31 31 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
32 32 .\" or http://www.opensolaris.org/os/licensing.
33 33 .\" See the License for the specific language governing permissions
34 34 .\" and limitations under the License.
35 35 .\"
36 36 .\" When distributing Covered Code, include this CDDL HEADER in each
37 37 .\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
↓ open down ↓ |
37 lines elided |
↑ open up ↑ |
38 38 .\" If applicable, add the following below this CDDL HEADER, with the
39 39 .\" fields enclosed by brackets "[]" replaced with your own identifying
40 40 .\" information: Portions Copyright [yyyy] [name of copyright owner]
41 41 .\"
42 42 .\"
43 43 .\" Copyright 1989 AT&T
44 44 .\" Copyright 1992 X/Open Company Limited
45 45 .\" Portions Copyright (c) 1982-2007 AT&T Knowledge Ventures
46 46 .\" Copyright (c) 2008, Sun Microsystems, Inc. All Rights Reserved
47 47 .\"
48 -.TH WAIT 1 "Mar 13, 2008"
48 +.TH WAIT 1 "May 17, 2020"
49 49 .SH NAME
50 50 wait \- await process completion
51 51 .SH SYNOPSIS
52 -.LP
53 52 .nf
54 53
55 54 .fi
56 55
57 56 .SS "/bin/sh"
58 -.LP
59 57 .nf
60 58 \fBwait\fR [\fIpid\fR]...
61 59 .fi
62 60
63 61 .SS "/bin/jsh /bin/ksh /usr/xpg4/bin/sh"
64 -.LP
65 62 .nf
66 63 \fBwait\fR [\fIpid\fR]...
67 64 .fi
68 65
69 66 .LP
70 67 .nf
71 68 \fBwait\fR [% \fIjobid\fR...]
72 69 .fi
73 70
74 71 .SS "/bin/csh"
75 -.LP
76 72 .nf
77 73 \fBwait\fR
78 74 .fi
79 75
80 76 .SS "ksh93"
81 -.LP
82 77 .nf
83 78 \fBwait\fR [\fIjob...\fR]
84 79 .fi
85 80
86 81 .SH DESCRIPTION
87 -.sp
88 -.LP
89 82 The shell itself executes \fBwait\fR, without creating a new process. If you
90 83 get the error message \fBcannot fork,too many processes\fR, try using the
91 84 \fBwait\fR command to clean up your background processes. If this doesn't help,
92 85 the system process table is probably full or you have too many active
93 86 foreground processes. There is a limit to the number of process \fBID\fRs
94 87 associated with your login, and to the number the system can keep track of.
95 88 .sp
96 89 .LP
97 90 Not all the processes of a pipeline with three or more stages are children of
98 91 the shell, and thus cannot be waited for.
99 92 .SS "/bin/sh, /bin/jsh"
100 -.sp
101 -.LP
102 93 Wait for your background process whose process \fBID\fR is \fIpid\fR and report
103 94 its termination status. If \fIpid\fR is omitted, all your shell's currently
104 95 active background processes are waited for and the return code is \fB0\fR. The
105 96 \fBwait\fR utility accepts a job identifier, when Job Control is enabled (jsh),
106 97 and the argument, \fIjobid\fR, is preceded by a percent sign (\fB%\fR).
107 98 .sp
108 99 .LP
109 100 If \fIpid\fR is not an active process \fBID,\fR the \fBwait\fR utility returns
110 101 immediately and the return code is \fB0\fR.
111 102 .SS "csh"
112 -.sp
113 -.LP
114 103 Wait for your background processes.
115 104 .SS "ksh"
116 -.sp
117 -.LP
118 105 When an asynchronous list is started by the shell, the process \fBID\fR of the
119 106 last command in each element of the asynchronous list becomes known in the
120 107 current shell execution environment.
121 108 .sp
122 109 .LP
123 110 If the \fBwait\fR utility is invoked with no operands, it waits until all
124 111 process \fBIDs\fR known to the invoking shell have terminated and exit with an
125 112 exit status of \fB0\fR.
126 113 .sp
127 114 .LP
128 115 If one or more \fIpid\fR or \fIjobid\fR operands are specified that represent
129 116 known process \fBID\fRs (or jobids), the \fBwait\fR utility waits until all of
130 117 them have terminated. If one or more \fIpid\fR or \fIjobid\fR operands are
↓ open down ↓ |
3 lines elided |
↑ open up ↑ |
131 118 specified that represent unknown process \fBID\fRs (or jobids), \fBwait\fR
132 119 treats them as if they were known process \fBID\fRs (or jobids) that exited
133 120 with exit status \fB127\fR. The exit status returned by the \fBwait\fR utility
134 121 is the exit status of the process requested by the last \fIpid\fR or
135 122 \fIjobid\fR operand.
136 123 .sp
137 124 .LP
138 125 The known process \fBID\fRs are applicable only for invocations of \fBwait\fR
139 126 in the current shell execution environment.
140 127 .SS "ksh93"
141 -.sp
142 -.LP
143 128 wait with no operands, waits until all jobs known to the invoking shell have
144 129 terminated. If one or more job operands are specified, wait waits until all of
145 130 them have completed. Each job can be specified as one of the following:
146 131 .sp
147 132 .ne 2
148 133 .na
149 134 \fB\fInumber\fR\fR
150 135 .ad
151 136 .RS 12n
152 137 \fInumber\fR refers to a process ID.
153 138 .RE
154 139
155 140 .sp
156 141 .ne 2
157 142 .na
158 143 \fB\fB-\fR\fInumber\fR\fR
159 144 .ad
160 145 .RS 12n
161 146 \fInumber\fR refers to a process group ID.
162 147 .RE
163 148
164 149 .sp
165 150 .ne 2
166 151 .na
167 152 \fB\fB%\fR\fInumber\fR\fR
168 153 .ad
169 154 .RS 12n
170 155 \fInumber\fR refers to a job number
171 156 .RE
172 157
173 158 .sp
174 159 .ne 2
175 160 .na
176 161 \fB\fB%\fR\fIstring\fR\fR
177 162 .ad
178 163 .RS 12n
179 164 Refers to a job whose name begins with \fIstring\fR
180 165 .RE
181 166
182 167 .sp
183 168 .ne 2
184 169 .na
185 170 \fB\fB%?\fR\fIstring\fR\fR
186 171 .ad
187 172 .RS 12n
188 173 Refers to a job whose name contains \fIstring\fR
189 174 .RE
190 175
191 176 .sp
192 177 .ne 2
193 178 .na
194 179 \fB\fB%+\fR\fR
195 180 .ad
196 181 .br
197 182 .na
198 183 \fB\fB%%\fR\fR
199 184 .ad
200 185 .RS 12n
201 186 Refers to the current job
202 187 .RE
203 188
204 189 .sp
↓ open down ↓ |
52 lines elided |
↑ open up ↑ |
205 190 .ne 2
206 191 .na
207 192 \fB\fB%-\fR\fR
208 193 .ad
209 194 .RS 12n
210 195 Refers to the previous job
211 196 .RE
212 197
213 198 .sp
214 199 .LP
215 -If one ore more job operands is a process id or process group id not known by
200 +If one or more job operands is a process id or process group id not known by
216 201 the current shell environment, \fBwait\fR treats each of them as if it were a
217 202 process that exited with status 127.
218 203 .SH OPERANDS
219 -.sp
220 -.LP
221 204 The following operands are supported:
222 205 .sp
223 206 .ne 2
224 207 .na
225 208 \fB\fIpid\fR\fR
226 209 .ad
227 210 .RS 9n
228 211 The unsigned decimal integer process \fBID\fR of a command, for which the
229 212 utility is to wait for the termination.
230 213 .RE
231 214
232 215 .sp
233 216 .ne 2
234 217 .na
↓ open down ↓ |
4 lines elided |
↑ open up ↑ |
235 218 \fB\fIjobid\fR\fR
236 219 .ad
237 220 .RS 9n
238 221 A job control job \fBID\fR that identifies a background process group to be
239 222 waited for. The job control job \fBID\fR notation is applicable only for
240 223 invocations of \fBwait\fR in the current shell execution environment, and only
241 224 on systems supporting the job control option.
242 225 .RE
243 226
244 227 .SH USAGE
245 -.sp
246 -.LP
247 228 On most implementations, \fBwait\fR is a shell built-in. If it is called in a
248 229 subshell or separate utility execution environment, such as one of the
249 230 following,
250 231 .sp
251 232 .in +2
252 233 .nf
253 234 (wait)
254 235 nohup wait ...
255 236 find . -exec wait ... \e;
256 237 .fi
257 238 .in -2
258 239 .sp
259 240
260 241 .sp
261 242 .LP
262 243 it returns immediately because there is no known process \fBID\fRs to wait for
263 244 in those environments.
264 245 .SH EXAMPLES
265 -.LP
266 246 \fBExample 1 \fRUsing A Script To Identify The Termination Signal
267 247 .sp
268 248 .LP
269 249 Although the exact value used when a process is terminated by a signal is
270 250 unspecified, if it is known that a signal terminated a process, a script can
271 251 still reliably figure out which signal is using \fBkill\fR, as shown by the
272 252 following (\fB/bin/ksh\fR and \fB/usr/xpg4/bin/sh\fR):
273 253
274 254 .sp
275 255 .in +2
276 256 .nf
277 257 sleep 1000&
278 258 pid=$!
279 259 kill -kill $pid
280 260 wait $pid
281 261 echo $pid was terminated by a SIG$(kill -l $(($?\(mi128))) signal.
282 262 .fi
283 263 .in -2
284 264 .sp
285 265
286 266 .LP
287 267 \fBExample 2 \fRReturning The Exit Status Of A Process
288 268 .sp
289 269 .LP
290 270 If the following sequence of commands is run in less than 31 seconds
291 271 (\fB/bin/ksh\fR and \fB/usr/xpg4/bin/sh\fR):
292 272
293 273 .sp
294 274 .in +2
295 275 .nf
296 276 sleep 257 | sleep 31 &
297 277
298 278 jobs -l %%
299 279 .fi
300 280 .in -2
301 281 .sp
302 282
303 283 .sp
304 284 .LP
305 285 then either of the following commands returns the exit status of the second
306 286 \fBsleep\fR in the pipeline:
307 287
↓ open down ↓ |
32 lines elided |
↑ open up ↑ |
308 288 .sp
309 289 .in +2
310 290 .nf
311 291 wait <\fIpid of sleep 31\fR>
312 292 wait %%
313 293 .fi
314 294 .in -2
315 295 .sp
316 296
317 297 .SH ENVIRONMENT VARIABLES
318 -.sp
319 -.LP
320 298 See \fBenviron\fR(5) for descriptions of the following environment variables
321 299 that affect the execution of \fBwait\fR: \fBLANG\fR, \fBLC_ALL\fR,
322 300 \fBLC_CTYPE\fR, \fBLC_MESSAGES\fR, and \fBNLSPATH\fR.
323 301 .SH EXIT STATUS
324 302 .SS "ksh93"
325 -.sp
326 -.LP
327 303 The following exit values are returned by the \fBwait\fR built-in in
328 304 \fBksh93\fR:
329 305 .sp
330 306 .ne 2
331 307 .na
332 308 \fB\fB0\fR\fR
333 309 .ad
334 310 .RS 7n
335 311 \fBwait\fR was invoked with no operands. All processes known by the invoking
336 312 process have terminated.
337 313 .RE
338 314
339 315 .sp
↓ open down ↓ |
3 lines elided |
↑ open up ↑ |
340 316 .ne 2
341 317 .na
342 318 \fB\fB127\fR\fR
343 319 .ad
344 320 .RS 7n
345 321 \fIjob\fR is a process id or process group id that is unknown to the current
346 322 shell environment.
347 323 .RE
348 324
349 325 .SH ATTRIBUTES
350 -.sp
351 -.LP
352 326 See \fBattributes\fR(5) for descriptions of the following attributes:
353 327 .sp
354 328
355 329 .sp
356 330 .TS
357 331 box;
358 332 c | c
359 333 l | l .
360 334 ATTRIBUTE TYPE ATTRIBUTE VALUE
361 335 _
362 336 Interface Stability Committed
363 337 _
364 338 Standard See \fBstandards\fR(5).
365 339 .TE
366 340
367 341 .SH SEE ALSO
368 -.sp
369 -.LP
370 342 \fBcsh\fR(1), \fBjobs\fR(1), \fBksh\fR(1), \fBksh93\fR(1), \fBsh\fR(1),
371 343 \fBattributes\fR(5), \fBenviron\fR(5), \fBstandards\fR(5)
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX