Print this page
12745 man page typos
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/man/man1/wait.1.man.txt
+++ new/usr/src/man/man1/wait.1.man.txt
1 1 WAIT(1) User Commands WAIT(1)
2 2
3 3
4 4
5 5 NAME
6 6 wait - await process completion
7 7
8 8 SYNOPSIS
9 9
10 10
11 11
12 12 /bin/sh
13 13 wait [pid]...
14 14
15 15
16 16 /bin/jsh /bin/ksh /usr/xpg4/bin/sh
17 17 wait [pid]...
18 18
19 19
20 20 wait [% jobid...]
21 21
22 22
23 23 /bin/csh
24 24 wait
25 25
26 26
27 27 ksh93
28 28 wait [job...]
29 29
30 30
31 31 DESCRIPTION
32 32 The shell itself executes wait, without creating a new process. If you
33 33 get the error message cannot fork,too many processes, try using the
34 34 wait command to clean up your background processes. If this doesn't
35 35 help, the system process table is probably full or you have too many
36 36 active foreground processes. There is a limit to the number of process
37 37 IDs associated with your login, and to the number the system can keep
38 38 track of.
39 39
40 40
41 41 Not all the processes of a pipeline with three or more stages are
42 42 children of the shell, and thus cannot be waited for.
43 43
44 44 /bin/sh, /bin/jsh
45 45 Wait for your background process whose process ID is pid and report its
46 46 termination status. If pid is omitted, all your shell's currently
47 47 active background processes are waited for and the return code is 0.
48 48 The wait utility accepts a job identifier, when Job Control is enabled
49 49 (jsh), and the argument, jobid, is preceded by a percent sign (%).
50 50
51 51
52 52 If pid is not an active process ID, the wait utility returns
53 53 immediately and the return code is 0.
54 54
55 55 csh
56 56 Wait for your background processes.
57 57
58 58 ksh
59 59 When an asynchronous list is started by the shell, the process ID of
60 60 the last command in each element of the asynchronous list becomes known
61 61 in the current shell execution environment.
62 62
63 63
64 64 If the wait utility is invoked with no operands, it waits until all
65 65 process IDs known to the invoking shell have terminated and exit with
66 66 an exit status of 0.
67 67
68 68
69 69 If one or more pid or jobid operands are specified that represent known
70 70 process IDs (or jobids), the wait utility waits until all of them have
71 71 terminated. If one or more pid or jobid operands are specified that
72 72 represent unknown process IDs (or jobids), wait treats them as if they
73 73 were known process IDs (or jobids) that exited with exit status 127.
74 74 The exit status returned by the wait utility is the exit status of the
75 75 process requested by the last pid or jobid operand.
76 76
77 77
78 78 The known process IDs are applicable only for invocations of wait in
79 79 the current shell execution environment.
80 80
81 81 ksh93
82 82 wait with no operands, waits until all jobs known to the invoking shell
83 83 have terminated. If one or more job operands are specified, wait waits
84 84 until all of them have completed. Each job can be specified as one of
85 85 the following:
86 86
87 87 number
88 88 number refers to a process ID.
89 89
90 90
91 91 -number
92 92 number refers to a process group ID.
93 93
94 94
95 95 %number
96 96 number refers to a job number
97 97
98 98
99 99 %string
100 100 Refers to a job whose name begins with string
101 101
102 102
103 103 %?string
104 104 Refers to a job whose name contains string
105 105
106 106
↓ open down ↓ |
106 lines elided |
↑ open up ↑ |
107 107 %+
108 108 %%
109 109 Refers to the current job
110 110
111 111
112 112 %-
113 113 Refers to the previous job
114 114
115 115
116 116
117 - If one ore more job operands is a process id or process group id not
117 + If one or more job operands is a process id or process group id not
118 118 known by the current shell environment, wait treats each of them as if
119 119 it were a process that exited with status 127.
120 120
121 121 OPERANDS
122 122 The following operands are supported:
123 123
124 124 pid
125 125 The unsigned decimal integer process ID of a command, for
126 126 which the utility is to wait for the termination.
127 127
128 128
129 129 jobid
130 130 A job control job ID that identifies a background process
131 131 group to be waited for. The job control job ID notation is
132 132 applicable only for invocations of wait in the current shell
133 133 execution environment, and only on systems supporting the job
134 134 control option.
135 135
136 136
137 137 USAGE
138 138 On most implementations, wait is a shell built-in. If it is called in a
139 139 subshell or separate utility execution environment, such as one of the
140 140 following,
141 141
142 142 (wait)
143 143 nohup wait ...
144 144 find . -exec wait ... \;
145 145
146 146
147 147
148 148
149 149 it returns immediately because there is no known process IDs to wait
150 150 for in those environments.
151 151
152 152 EXAMPLES
153 153 Example 1 Using A Script To Identify The Termination Signal
154 154
155 155
156 156 Although the exact value used when a process is terminated by a signal
157 157 is unspecified, if it is known that a signal terminated a process, a
158 158 script can still reliably figure out which signal is using kill, as
159 159 shown by the following (/bin/ksh and /usr/xpg4/bin/sh):
160 160
161 161
162 162 sleep 1000&
163 163 pid=$!
164 164 kill -kill $pid
165 165 wait $pid
166 166 echo $pid was terminated by a SIG$(kill -l $(($?-128))) signal.
167 167
168 168
169 169
170 170 Example 2 Returning The Exit Status Of A Process
171 171
172 172
173 173 If the following sequence of commands is run in less than 31 seconds
174 174 (/bin/ksh and /usr/xpg4/bin/sh):
175 175
176 176
177 177 sleep 257 | sleep 31 &
178 178
179 179 jobs -l %%
180 180
181 181
182 182
183 183
184 184 then either of the following commands returns the exit status of the
185 185 second sleep in the pipeline:
186 186
187 187
188 188 wait <pid of sleep 31>
189 189 wait %%
190 190
191 191
192 192
193 193 ENVIRONMENT VARIABLES
194 194 See environ(5) for descriptions of the following environment variables
195 195 that affect the execution of wait: LANG, LC_ALL, LC_CTYPE, LC_MESSAGES,
196 196 and NLSPATH.
197 197
198 198 EXIT STATUS
199 199 ksh93
200 200 The following exit values are returned by the wait built-in in ksh93:
201 201
202 202 0
203 203 wait was invoked with no operands. All processes known by the
204 204 invoking process have terminated.
205 205
206 206
207 207 127
208 208 job is a process id or process group id that is unknown to the
209 209 current shell environment.
210 210
211 211
212 212 ATTRIBUTES
213 213 See attributes(5) for descriptions of the following attributes:
214 214
215 215
216 216
217 217
218 218 +--------------------+-------------------+
219 219 | ATTRIBUTE TYPE | ATTRIBUTE VALUE |
220 220 +--------------------+-------------------+
221 221 |Interface Stability | Committed |
↓ open down ↓ |
94 lines elided |
↑ open up ↑ |
222 222 +--------------------+-------------------+
223 223 |Standard | See standards(5). |
224 224 +--------------------+-------------------+
225 225
226 226 SEE ALSO
227 227 csh(1), jobs(1), ksh(1), ksh93(1), sh(1), attributes(5), environ(5),
228 228 standards(5)
229 229
230 230
231 231
232 - March 13, 2008 WAIT(1)
232 + May 17, 2020 WAIT(1)
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX