Print this page
13507 some man pages need update following 13405
6308 some man pages are obsolete after moving to ksh builtins
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/man/man1/jobs.1
+++ new/usr/src/man/man1/jobs.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
↓ open down ↓ |
36 lines elided |
↑ open up ↑ |
37 37 .\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
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 .\" Portions Copyright (c) 1992, X/Open Company Limited All Rights Reserved
45 45 .\" Portions Copyright (c) 1982-2007 AT&T Knowledge Ventures
46 46 .\" Copyright (c) 2007, Sun Microsystems, Inc. All Rights Reserved
47 +.\" Copyright 2021 OmniOS Community Edition (OmniOSce) Association.
47 48 .\"
48 -.TH JOBS 1 "Nov 2, 2007"
49 +.TH JOBS 1 "Feb 9, 2021"
49 50 .SH NAME
50 51 jobs, fg, bg, stop, notify \- control process execution
51 52 .SH SYNOPSIS
52 -.SS "sh"
53 -.LP
54 -.nf
55 -\fBjobs\fR [\fB-p\fR | \fB-l\fR] [% \fIjob_id\fR...]
56 -.fi
57 53
58 -.LP
59 -.nf
60 -\fBjobs\fR \fB-x\fR \fIcommand\fR [\fIarguments\fR]
61 -.fi
62 -
63 -.LP
64 -.nf
65 -\fBfg\fR [% \fIjob_id\fR...]
66 -.fi
67 -
68 -.LP
69 -.nf
70 -\fBbg\fR [% \fIjob_id\fR...]
71 -.fi
72 -
73 -.LP
74 -.nf
75 -\fBstop\fR % \fIjob_id\fR...
76 -.fi
77 -
78 -.LP
79 -.nf
80 -\fBstop\fR \fIpid\fR...
81 -.fi
82 -
83 54 .SS "csh"
84 -.LP
85 55 .nf
86 56 \fBjobs\fR [\fB-l\fR]
87 57 .fi
88 58
89 59 .LP
90 60 .nf
91 61 \fBfg\fR [% \fIjob_id\fR]
92 62 .fi
93 63
94 64 .LP
95 65 .nf
96 66 \fBbg\fR [% \fIjob_id\fR]...
97 67 .fi
98 68
99 69 .LP
100 70 .nf
101 71 \fBnotify\fR [% \fIjob_id\fR]...
102 72 .fi
103 73
↓ open down ↓ |
9 lines elided |
↑ open up ↑ |
104 74 .LP
105 75 .nf
106 76 \fBstop\fR % \fIjob_id\fR...
107 77 .fi
108 78
109 79 .LP
110 80 .nf
111 81 \fBstop\fR \fIpid\fR...
112 82 .fi
113 83
114 -.SS "ksh"
115 -.LP
116 -.nf
117 -\fBjobs\fR [\fB-lnp\fR] [% \fIjob_id\fR...]
118 -.fi
119 -
120 -.LP
121 -.nf
122 -\fBfg\fR [% \fIjob_id\fR...]
123 -.fi
124 -
125 -.LP
126 -.nf
127 -\fBbg\fR [% \fIjob_id\fR...]
128 -.fi
129 -
130 -.LP
131 -.nf
132 -\fBstop\fR % \fIjob_id\fR...
133 -.fi
134 -
135 -.LP
136 -.nf
137 -\fBstop\fR \fIpid\fR...
138 -.fi
139 -
140 84 .SS "ksh93"
141 -.LP
142 85 .nf
143 86 \fBjobs\fR [\fB-lnp\fR] [\fIjob_id\fR...]
144 87 .fi
145 88
146 89 .LP
147 90 .nf
148 91 \fBfg\fR [\fIjob_id\fR...]
149 92 .fi
150 93
151 94 .LP
152 95 .nf
153 96 \fBbg\fR [\fIjob_id\fR...]
154 97 .fi
155 98
156 99 .SH DESCRIPTION
157 -.SS "sh"
158 -.sp
159 -.LP
160 -When Job Control is enabled, the Bourne shell built-in \fBjobs\fR reports all
161 -jobs that are stopped or executing in the background. If \fB%\fR\fIjob_id\fR is
162 -omitted, all jobs that are stopped or running in the background is reported.
163 -The following options modify or enhance the output of \fBjobs\fR:
164 -.sp
165 -.ne 2
166 -.na
167 -\fB\fB-l\fR\fR
168 -.ad
169 -.RS 6n
170 -Reports the process group \fBID\fR and working directory of the jobs.
171 -.RE
172 -
173 -.sp
174 -.ne 2
175 -.na
176 -\fB\fB-p\fR\fR
177 -.ad
178 -.RS 6n
179 -Reports only the process group \fBID\fR of the jobs.
180 -.RE
181 -
182 -.sp
183 -.ne 2
184 -.na
185 -\fB\fB-x\fR\fR
186 -.ad
187 -.RS 6n
188 -Replaces any \fIjob_id\fR found in \fIcommand\fR or \fIarguments\fR with the
189 -corresponding process group \fBID\fR, and then executes \fIcommand\fR passing
190 -it \fIarguments\fR.
191 -.RE
192 -
193 -.sp
194 -.LP
195 -When the shell is invoked as \fBjsh\fR, Job Control is enabled in addition to
196 -all of the functionality described previously for \fBsh\fR. Typically Job
197 -Control is enabled for the interactive shell only. Non-interactive shells
198 -typically do not benefit from the added functionality of Job Control.
199 -.sp
200 -.LP
201 -With Job Control enabled every command or pipeline the user enters at the
202 -terminal is called a \fIjob_id\fR. All jobs exist in one of the following
203 -states: foreground, background or stopped. These terms are defined as follows:
204 -.RS +4
205 -.TP
206 -1.
207 -A job in the \fBforeground\fR has read and write access to the controlling
208 -terminal.
209 -.RE
210 -.RS +4
211 -.TP
212 -2.
213 -A job in the \fBbackground\fR is denied read access and has conditional
214 -write access to the controlling terminal (see \fBstty\fR(1))
215 -.RE
216 -.RS +4
217 -.TP
218 -3.
219 -A \fBstopped\fR job is a job that has been placed in a suspended state,
220 -usually as a result of a \fBSIGTSTP\fR signal (see \fBsignal.h\fR(3HEAD)).
221 -.RE
222 -.sp
223 -.LP
224 -Every job that the shell starts is assigned a positive integer, called a
225 -\fIjob_id number\fR which is tracked by the shell and are used as an identifier
226 -to indicate a specific job. Additionally, the shell keeps track of the
227 -\fBcurrent\fR and \fBprevious\fR jobs. The \fBcurrent job\fR is the most recent
228 -job to be started or restarted. The \fBprevious job\fR is the first non-current
229 -job.
230 -.sp
231 -.LP
232 -The acceptable syntax for a Job Identifier is of the form:
233 -.sp
234 -.LP
235 -\fB%\fR\fIjob_id\fR
236 -.sp
237 -.LP
238 -where \fIjob_id\fR can be specified in any of the following formats:
239 -.sp
240 -.ne 2
241 -.na
242 -\fB\fB%\fR or \fB+\fR\fR
243 -.ad
244 -.RS 13n
245 -for the current job
246 -.RE
247 -
248 -.sp
249 -.ne 2
250 -.na
251 -\fB\fB\(mi\fR\fR
252 -.ad
253 -.RS 13n
254 -for the previous job
255 -.RE
256 -
257 -.sp
258 -.ne 2
259 -.na
260 -\fB\fB?\fR\fI<string>\fR\fR
261 -.ad
262 -.RS 13n
263 -specify the job for which the command line uniquely contains \fIstring\fR.
264 -.RE
265 -
266 -.sp
267 -.ne 2
268 -.na
269 -\fB\fIn\fR\fR
270 -.ad
271 -.RS 13n
272 -for job number \fIn\fR, where \fIn\fR is a job number
273 -.RE
274 -
275 -.sp
276 -.ne 2
277 -.na
278 -\fB\fIpref\fR\fR
279 -.ad
280 -.RS 13n
281 -where \fIpref\fR is a unique prefix of the command name (for example, if the
282 -command \fBls \(mil name\fR were running in the background, it could be
283 -referred to as \fB%ls\fR); \fIpref\fR cannot contain blanks unless it is
284 -quoted.
285 -.RE
286 -
287 -.sp
288 -.LP
289 -When Job Control is enabled, \fBfg\fR resumes the execution of a stopped job in
290 -the foreground, also moves an executing background job into the foreground. If
291 -\fB%\fR\fIjob_id\fR is omitted the current job is assumed.
292 -.sp
293 -.LP
294 -When Job Control is enabled, \fBbg\fR resumes the execution of a stopped job in
295 -the background. If \fB%\fR\fIjob_id\fR is omitted the current job is assumed.
296 -.sp
297 -.LP
298 -\fBstop\fR stops the execution of a background job(s) by using its
299 -\fIjob_id\fR, or of any process by using its \fIpid\fR; see \fBps\fR(1).
300 100 .SS "csh"
301 -.sp
302 -.LP
303 101 The C shell built-in, \fBjobs\fR, without an argument, lists the active jobs
304 102 under job control.
305 103 .sp
306 104 .ne 2
307 105 .na
308 106 \fB\fB-l\fR\fR
309 107 .ad
310 108 .RS 6n
311 109 List process \fBID\fRs, in addition to the normal information.
312 110 .RE
313 111
314 112 .sp
315 113 .LP
316 114 The shell associates a numbered \fIjob_id\fR with each command sequence to keep
317 115 track of those commands that are running in the background or have been stopped
318 116 with \fBTSTP\fR signals (typically Control-Z). When a command or command
319 117 sequence (semicolon-separated list) is started in the background using the
320 118 \fB&\fR metacharacter, the shell displays a line with the job number in
321 119 brackets and a list of associated process numbers:
322 120 .sp
323 121 .LP
324 122 \fB[1] 1234\fR
325 123 .sp
326 124 .LP
327 125 To see the current list of jobs, use the \fBjobs\fR built-in command. The job
328 126 most recently stopped (or put into the background if none are stopped) is
329 127 referred to as the \fBcurrent\fR job and is indicated with a `\fB+\fR'. The
330 128 previous job is indicated with a `\fB\(mi\fR\&'; when the current job is
331 129 terminated or moved to the foreground, this job takes its place (becomes the
332 130 new current job).
333 131 .sp
334 132 .LP
335 133 To manipulate jobs, refer to the \fBbg\fR, \fBfg\fR, \fBkill\fR, \fBstop\fR,
336 134 and \fB%\fR built-in commands.
337 135 .sp
338 136 .LP
339 137 A reference to a job begins with a `\fB%\fR'. By itself, the percent sign
340 138 refers to the current job.
341 139 .sp
342 140 .ne 2
343 141 .na
344 142 \fB\fB%\fR \fB%+\fR \fB%%\fR\fR
345 143 .ad
346 144 .RS 12n
347 145 The current job.
348 146 .RE
349 147
350 148 .sp
351 149 .ne 2
352 150 .na
353 151 \fB\fB%\(mi\fR\fR
354 152 .ad
355 153 .RS 12n
356 154 The previous job.
357 155 .RE
358 156
359 157 .sp
360 158 .ne 2
361 159 .na
362 160 \fB\fB%\fR\fIj\fR\fR
363 161 .ad
364 162 .RS 12n
365 163 Refer to job \fIj\fR as in: `\fBkill\fR \fB-9\fR \fB%\fR\fIj\fR'. \fIj\fR can
366 164 be a job number, or a string that uniquely specifies the command line by which
367 165 it was started; `\fBfg %vi\fR' might bring a stopped \fBvi\fR job to the
368 166 foreground, for instance.
369 167 .RE
370 168
371 169 .sp
372 170 .ne 2
373 171 .na
374 172 \fB\fB%?\fR\fIstring\fR\fR
375 173 .ad
376 174 .RS 12n
377 175 Specify the job for which the command line uniquely contains \fIstring\fR.
378 176 .RE
379 177
380 178 .sp
381 179 .LP
382 180 A job running in the background stops when it attempts to read from the
383 181 terminal. Background jobs can normally produce output, but this can be
384 182 suppressed using the `\fBstty tostop\fR' command.
385 183 .sp
386 184 .LP
387 185 \fBfg\fR brings the current or specified \fIjob_id\fR into the foreground.
388 186 .sp
↓ open down ↓ |
76 lines elided |
↑ open up ↑ |
389 187 .LP
390 188 \fBbg\fR runs the current or specified jobs in the background.
391 189 .sp
392 190 .LP
393 191 \fBstop\fR stops the execution of a background job(s) by using its
394 192 \fIjob_id\fR, or of any process by using its \fIpid\fR; see \fBps\fR(1).
395 193 .sp
396 194 .LP
397 195 \fBnotify\fR notifies the user asynchronously when the status of the current
398 196 job or specified jobs changes.
399 -.SS "ksh"
400 -.sp
401 -.LP
402 -\fBjobs\fR displays the status of the jobs that were started in the current
403 -shell environment. When \fBjobs\fR reports the termination status of a job, the
404 -shell removes its process \fBID\fR from the list of those known in the current
405 -shell execution environment.
406 -.sp
407 -.LP
408 -\fIjob_id\fR specifies the jobs for which the status is to be displayed. If no
409 -\fIjob_id\fR is specified, the status information for all jobs are displayed.
410 -.sp
411 -.LP
412 -The following options modify or enhance the output of \fBjobs\fR:
413 -.sp
414 -.ne 2
415 -.na
416 -\fB\fB-l\fR\fR
417 -.ad
418 -.RS 6n
419 -(The letter ell.) Provides more information about each job listed. This
420 -information includes the job number, current job, process group \fBID\fR, state
421 -and the command that formed the job.
422 -.RE
423 -
424 -.sp
425 -.ne 2
426 -.na
427 -\fB\fB-n\fR\fR
428 -.ad
429 -.RS 6n
430 -Displays only jobs that have stopped or exited since last notified.
431 -.RE
432 -
433 -.sp
434 -.ne 2
435 -.na
436 -\fB\fB-p\fR\fR
437 -.ad
438 -.RS 6n
439 -Displays only the process \fBID\fRs for the process group leaders of the
440 -selected jobs.
441 -.RE
442 -
443 -.sp
444 -.LP
445 -By default, \fBjobs\fR displays the status of all the stopped jobs, running
446 -background jobs, and all jobs whose status has changed and have not been
447 -reported by the shell.
448 -.sp
449 -.LP
450 -If the \fBmonitor\fR option of the \fBset\fR command is turned on, an
451 -interactive shell associates a \fBjob\fR with each pipeline. It keeps a table
452 -of current jobs, printed by the \fBjobs\fR command, and assigns them small
453 -integer numbers. When a job is started asynchronously with \fB&\fR, the shell
454 -prints a line which looks like:
455 -.sp
456 -.LP
457 -\fB[1]\fR \fB1234\fR
458 -.sp
459 -.LP
460 -indicating that the job, which was started asynchronously, was job number
461 -\fB1\fR and had one (top-level) process, whose process id was \fB1234\fR.
462 -.sp
463 -.LP
464 -If you are running a job and wish to do something else you can hit the key ^Z
465 -(Control-Z) which sends a \fBSTOP\fR signal to the current job. The shell then
466 -normally indicates that the job has been "\fBStopped\fR" (see \fBOUTPUT\fR
467 -below), and print another prompt. You can then manipulate the state of this
468 -job, putting it in the background with the \fBbg\fR command, or run some other
469 -commands and then eventually bring the job back into the foreground with the
470 -foreground command \fBfg\fR. A ^Z takes effect immediately and is like an
471 -interrupt, in that pending output and unread input are discarded when it is
472 -typed.
473 -.sp
474 -.LP
475 -There are several ways to refer to jobs in the shell. A job can be referred to
476 -by the process id of any process of the job or by one of the following:
477 -.sp
478 -.ne 2
479 -.na
480 -\fB\fB%\fR\fInumber\fR\fR
481 -.ad
482 -.RS 12n
483 -The job with the specified number.
484 -.RE
485 -
486 -.sp
487 -.ne 2
488 -.na
489 -\fB\fB%\fR\fIstring\fR\fR
490 -.ad
491 -.RS 12n
492 -Any job whose command line begins with \fIstring\fR; works only in the
493 -interactive mode when the history file is active.
494 -.RE
495 -
496 -.sp
497 -.ne 2
498 -.na
499 -\fB\fB%?\fR\fIstring\fR\fR
500 -.ad
501 -.RS 12n
502 -Any job whose command line contains \fIstring\fR; works only in the interactive
503 -mode when the history file is active.
504 -.RE
505 -
506 -.sp
507 -.ne 2
508 -.na
509 -\fB\fB%%\fR\fR
510 -.ad
511 -.RS 12n
512 -Current job.
513 -.RE
514 -
515 -.sp
516 -.ne 2
517 -.na
518 -\fB\fB%+\fR\fR
519 -.ad
520 -.RS 12n
521 -Equivalent to \fB%%\fR.
522 -.RE
523 -
524 -.sp
525 -.ne 2
526 -.na
527 -\fB\fB%\(mi\fR\fR
528 -.ad
529 -.RS 12n
530 -Previous job.
531 -.RE
532 -
533 -.sp
534 -.LP
535 -The shell learns immediately whenever a process changes state. It normally
536 -informs you whenever a job becomes blocked so that no further progress is
537 -possible, but only just before it prints a prompt. This is done so that it does
538 -not otherwise disturb your work. When the monitor mode is on, each background
539 -job that completes triggers any trap set for \fBCHLD\fR. When you try to leave
540 -the shell while jobs are running or stopped, you are warned that `You have
541 -stopped (running) jobs.' You can use the \fBjobs\fR command to see what they
542 -are. If you do this or immediately try to exit again, the shell does not warn
543 -you a second time, and the stopped jobs are terminated.
544 -.sp
545 -.LP
546 -\fBfg\fR moves a background job from the current environment into the
547 -foreground. Using \fBfg\fR to place a job in the foreground removes its process
548 -\fBID\fR from the list of those known in the current shell execution
549 -environment. The \fBfg\fR command is available only on systems that support job
550 -control. If \fIjob_id\fR is not specified, the current job is brought into the
551 -foreground.
552 -.sp
553 -.LP
554 -\fBbg\fR resumes suspended jobs from the current environment by running them as
555 -background jobs. If the job specified by \fIjob_id\fR is already a running
556 -background job, \fBbg\fR has no effect and exits successfully. Using \fBbg\fR
557 -to place a job into the background causes its process \fBID\fR to become `known
558 -in the current shell execution environment, as if it had been started as an
559 -asynchronous list. The \fBbg\fR command is available only on systems that
560 -support job control. If \fIjob_id\fR is not specified, the current job is
561 -placed in the background.
562 -.sp
563 -.LP
564 -\fBstop\fR stops the execution of a background job(s) by using its
565 -\fIjob_id\fR, or of any process by using its \fIpid\fR. See \fBps\fR(1).
566 197 .SS "ksh93"
567 -.sp
568 -.LP
569 198 \fBjobs\fR displays information about specified jobs that were started by the
570 199 current shell environment on standard output. The information contains the job
571 200 number enclosed in \fB[...]\fR, the status, and the command line that started
572 201 the job.
573 202 .sp
574 203 .LP
575 204 If \fIjob_id\fR is omitted, \fBjobs\fR displays the status of all stopped jobs,
576 205 background jobs, and all jobs whose status has changed since last reported by
577 206 the shell.
578 207 .sp
579 208 .LP
580 209 When \fBjobs\fR reports the termination status of a job, the shell removes the
581 210 job from the list of known jobs in the current shell environment.
582 211 .sp
583 212 .LP
584 213 The following options modify or enhances the output of \fBjobs\fR:
585 214 .sp
586 215 .ne 2
587 216 .na
588 217 \fB\fB-l\fR\fR
589 218 .ad
590 219 .RS 6n
591 220 Displays process IDs after the job number in addition to the usual information.
592 221 .RE
593 222
594 223 .sp
595 224 .ne 2
596 225 .na
597 226 \fB\fB-n\fR\fR
598 227 .ad
599 228 .RS 6n
600 229 Displays only the jobs whose status has changed since the last prompt was
601 230 displayed.
602 231 .RE
603 232
604 233 .sp
605 234 .ne 2
606 235 .na
607 236 \fB\fB-p\fR\fR
608 237 .ad
609 238 .RS 6n
610 239 Displays the process group leader IDs for the specified jobs.
611 240 .RE
612 241
613 242 .sp
614 243 .LP
615 244 \fIjob_id\fR can be specified to \fBjobs\fR, \fBfg\fR, and \fBbg\fR as one of
616 245 the following:
617 246 .sp
618 247 .ne 2
619 248 .na
620 249 \fB\fInumber\fR\fR
621 250 .ad
622 251 .RS 12n
623 252 The process id of \fBjob\fR.
624 253 .RE
625 254
626 255 .sp
627 256 .ne 2
628 257 .na
629 258 \fB\fB-\fR\fInumber\fR\fR
630 259 .ad
631 260 .RS 12n
632 261 The process group id of \fBjob\fR.
633 262 .RE
634 263
635 264 .sp
636 265 .ne 2
637 266 .na
638 267 \fB\fB%\fR\fInumber\fR\fR
639 268 .ad
640 269 .RS 12n
641 270 The job number.
642 271 .RE
643 272
644 273 .sp
645 274 .ne 2
646 275 .na
647 276 \fB\fB%\fR\fIstring\fR\fR
648 277 .ad
649 278 .RS 12n
650 279 The job whose name begins with \fIstring\fR.
651 280 .RE
652 281
653 282 .sp
654 283 .ne 2
655 284 .na
656 285 \fB\fB%?\fR\fIstring\fR\fR
657 286 .ad
658 287 .RS 12n
659 288 The job whose name contains \fIstring\fR.
660 289 .RE
661 290
662 291 .sp
663 292 .ne 2
664 293 .na
665 294 \fB\fB%+\fR\fR
666 295 .ad
667 296 .br
668 297 .na
669 298 \fB\fB%%\fR\fR
670 299 .ad
671 300 .RS 12n
672 301 The current job.
673 302 .RE
674 303
675 304 .sp
676 305 .ne 2
677 306 .na
678 307 \fB\fB%-\fR\fR
679 308 .ad
680 309 .RS 12n
681 310 The previous job.
682 311 .RE
683 312
684 313 .sp
↓ open down ↓ |
106 lines elided |
↑ open up ↑ |
685 314 .LP
686 315 \fBfg\fR places the specified jobs into the foreground in sequence and sends a
687 316 \fBCONT\fR signal to start each running. If \fIjob_id\fR is omitted, the most
688 317 recently started or stopped background job is moved to the foreground.
689 318 .sp
690 319 .LP
691 320 \fBbg\fR places the specified jobs into the background and sends a \fBCONT\fR
692 321 signal to start them running. If \fIjob_id\fR is omitted, the most recently
693 322 started or stopped background job is resumed or continued in the background.
694 323 .SH OUTPUT
695 -.sp
696 -.LP
697 324 If the \fB-p\fR option is specified, the output consists of one line for each
698 325 process \fBID\fR:
699 326 .sp
700 327 .LP
701 328 \fB"%d\en",\fR \fI"process ID"\fR
702 329 .sp
703 330 .LP
704 331 Otherwise, if the \fB-l\fR option is not specified, the output is a series of
705 332 lines of the form:
706 333 .sp
707 334 .LP
708 335 \fB"[%d] %c %s %s\en"\fR, \fIjob-number\fR, \fIcurrent\fR, \fIstate\fR,
709 336 \fIcommand\fR
710 337 .sp
711 338 .LP
712 339 where the fields are as follows:
713 340 .sp
714 341 .ne 2
715 342 .na
716 343 \fB\fIcurrent\fR\fR
717 344 .ad
718 345 .RS 14n
719 346 The character \fB+\fR identifies the job that would be used as a default for
720 347 the \fBfg\fR or \fBbg\fR commands. This job can also be specified using the
721 348 \fIjob_id\fR \fB%+\fR or \fB%%\fR \fB\&.\fR The character \fB\(mi\fR identifies
722 349 the job that would become the default if the current default job were to exit;
723 350 this job can also be specified using the \fIjob_id\fR \fB%\(mi\fR \fB\&.\fR For
724 351 other jobs, this field is a space character. At most, one job can be identified
725 352 with \fB+\fR and at most one job can be identified with \fB\(mi\fR\&. If there
726 353 is any suspended job, then the current job is a suspended job. If there are at
727 354 least two suspended jobs, then the previous job is also a suspended job.
728 355 .RE
729 356
730 357 .sp
731 358 .ne 2
732 359 .na
733 360 \fB\fIjob-number\fR\fR
734 361 .ad
735 362 .RS 14n
736 363 A number that can be used to identify the process group to the \fBwait\fR,
737 364 \fBfg\fR, \fBbg,\fR and \fBkill\fR utilities. Using these utilities, the job
738 365 can be identified by prefixing the job number with \fB%\fR.
739 366 .RE
740 367
741 368 .sp
742 369 .ne 2
743 370 .na
744 371 \fB\fIstate\fR\fR
745 372 .ad
746 373 .RS 14n
747 374 One of the following strings in the POSIX Locale:
748 375 .sp
749 376 .ne 2
750 377 .na
751 378 \fB\fBRunning\fR\fR
752 379 .ad
753 380 .RS 20n
754 381 Indicates that the job has not been suspended by a signal and has not exited.
755 382 .RE
756 383
757 384 .sp
758 385 .ne 2
759 386 .na
760 387 \fB\fBDone\fR\fR
761 388 .ad
762 389 .RS 20n
763 390 Indicates that the job completed and returned exit status zero.
764 391 .RE
765 392
766 393 .sp
767 394 .ne 2
768 395 .na
769 396 \fB\fBDone\fR(\fIcode\fR)\fR
770 397 .ad
771 398 .RS 20n
772 399 Indicates that the job completed normally and that it exited with the specified
773 400 \fBnon-zero\fR exit status, \fIcode\fR, expressed as a decimal number.
774 401 .RE
775 402
776 403 .sp
777 404 .ne 2
778 405 .na
779 406 \fB\fBStopped\fR\fR
780 407 .ad
781 408 .RS 20n
782 409 Indicates that the job was stopped.
783 410 .RE
784 411
785 412 .sp
786 413 .ne 2
787 414 .na
788 415 \fB\fBStopped(SIGTSTP)\fR\fR
789 416 .ad
790 417 .RS 20n
791 418 Indicates that the job was suspended by the \fBSIGTSTP\fR signal.
792 419 .RE
793 420
794 421 .sp
795 422 .ne 2
796 423 .na
797 424 \fB\fBStopped(SIGSTOP)\fR\fR
798 425 .ad
799 426 .RS 20n
800 427 Indicates that the job was suspended by the \fBSIGSTOP\fR signal.
801 428 .RE
802 429
803 430 .sp
804 431 .ne 2
805 432 .na
806 433 \fB\fBStopped(SIGTTIN)\fR\fR
807 434 .ad
808 435 .RS 20n
809 436 Indicates that the job was suspended by the \fBSIGTTIN\fR signal.
810 437 .RE
811 438
812 439 .sp
813 440 .ne 2
814 441 .na
815 442 \fB\fBStopped(SIGTTOU)\fR\fR
816 443 .ad
817 444 .RS 20n
818 445 Indicates that the job was suspended by the \fBSIGTTOU\fR signal.
819 446 .RE
820 447
821 448 The implementation can substitute the string \fBSuspended\fR in place of
822 449 \fBStopped\fR. If the job was terminated by a signal, the format of \fBstate\fR
823 450 is unspecified, but it is visibly distinct from all of the other \fBstate\fR
824 451 formats shown here and indicates the name or description of the signal causing
825 452 the termination.
826 453 .RE
827 454
828 455 .sp
829 456 .ne 2
830 457 .na
831 458 \fB\fIcommand\fR\fR
832 459 .ad
833 460 .RS 14n
↓ open down ↓ |
127 lines elided |
↑ open up ↑ |
834 461 The associated command that was specified to the shell.
835 462 .RE
836 463
837 464 .sp
838 465 .LP
839 466 If the \fB-l\fR option is specified, a field containing the process group
840 467 \fBID\fR is inserted before the \fBstate\fR field. Also, more processes in a
841 468 process group can be output on separate lines, using only the process \fBID\fR
842 469 and \fBcommand\fR fields.
843 470 .SH ENVIRONMENT VARIABLES
844 -.sp
845 -.LP
846 471 See \fBenviron\fR(5) for descriptions of the following environment variables
847 472 that affect the execution of \fBjobs\fR, \fBfg\fR, and \fBbg\fR: \fBLANG\fR,
848 473 \fBLC_ALL\fR, \fBLC_CTYPE\fR, \fBLC_MESSAGES\fR, and \fBNLSPATH\fR.
849 474 .SH EXIT STATUS
850 -.SS "sh, csh, ksh"
851 -.sp
852 -.LP
475 +.SS "csh"
853 476 The following exit values are returned for \fBjobs\fR, \fBfg\fR, and \fBbg\fR:
854 477 .sp
855 478 .ne 2
856 479 .na
857 480 \fB\fB0\fR\fR
858 481 .ad
859 482 .RS 6n
860 483 Successful completion.
861 484 .RE
862 485
863 486 .sp
864 487 .ne 2
865 488 .na
866 489 \fB\fB>0\fR\fR
867 490 .ad
868 491 .RS 6n
869 492 An error occurred.
870 493 .RE
871 494
872 495 .SS "ksh93"
873 -.sp
874 -.LP
875 496 The following exit values are returned for \fBjobs\fR:
876 497 .sp
877 498 .ne 2
878 499 .na
879 500 \fB\fB0\fR\fR
880 501 .ad
881 502 .RS 6n
882 503 The information for each job is written to standard output.
883 504 .RE
884 505
885 506 .sp
886 507 .ne 2
887 508 .na
888 509 \fB\fB>0\fR\fR
889 510 .ad
890 511 .RS 6n
891 512 One or more jobs does not exist.
892 513 .RE
893 514
894 515 .sp
895 516 .LP
896 517 The following exit values are returned for \fBfg\fR:
897 518 .sp
898 519 .ne 2
899 520 .na
900 521 \fB\fBexit status of last job\fR\fR
901 522 .ad
902 523 .RS 27n
903 524 One or more jobs has been brought into the foreground.
904 525 .RE
905 526
906 527 .sp
907 528 .ne 2
908 529 .na
909 530 \fB\fBnon-zero\fR\fR
910 531 .ad
911 532 .RS 27n
912 533 One or more jobs does not exist or has completed.
913 534 .RE
914 535
915 536 .sp
916 537 .LP
917 538 The following exit values are returned for \fBbg\fR:
918 539 .sp
919 540 .ne 2
920 541 .na
921 542 \fB\fB0\fR\fR
922 543 .ad
923 544 .RS 6n
924 545 All background jobs are started.
925 546 .RE
926 547
↓ open down ↓ |
42 lines elided |
↑ open up ↑ |
927 548 .sp
928 549 .ne 2
929 550 .na
930 551 \fB\fB>0\fR\fR
931 552 .ad
932 553 .RS 6n
933 554 One more jobs does not exist or there are no background jobs.
934 555 .RE
935 556
936 557 .SH ATTRIBUTES
937 -.sp
938 -.LP
939 558 See \fBattributes\fR(5) for descriptions of the following attributes:
940 -.SS "csh, sh, ksh"
941 -.sp
942 -
943 -.sp
559 +.SS "csh"
944 560 .TS
945 561 box;
946 562 c | c
947 563 l | l .
948 564 ATTRIBUTE TYPE ATTRIBUTE VALUE
949 565 _
950 566 Interface Stability Committed
951 567 _
952 568 Standard See \fBstandards\fR(5).
953 569 .TE
954 570
955 571 .SS "ksh93"
956 -.sp
957 -
958 -.sp
959 572 .TS
960 573 box;
961 574 c | c
962 575 l | l .
963 576 ATTRIBUTE TYPE ATTRIBUTE VALUE
964 577 _
965 578 Interface Stability Uncommitted
966 579 .TE
967 580
968 581 .SH SEE ALSO
969 -.sp
970 -.LP
971 -\fBcsh\fR(1), \fBkill\fR(1), \fBksh\fR(1), \fBksh93\fR(1), \fBps\fR(1),
972 -\fBsh\fR(1), \fBstop\fR(1), \fBshell_builtins\fR(1), \fBstty\fR(1),
582 +\fBcsh\fR(1), \fBkill\fR(1), \fBksh93\fR(1), \fBps\fR(1),
583 +\fBstop\fR(1), \fBshell_builtins\fR(1), \fBstty\fR(1),
973 584 \fBwait\fR(1), \fBsignal.h\fR(3HEAD), \fBattributes\fR(5), \fBenviron\fR(5),
974 585 \fBstandards\fR(5)
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX