jobs(1)
jobs --
display status of jobs in the current session
Synopsis
/usr/bin/jobs [-l | -p] [job_id ...]
Description
This shell script executes the builtin command of the same name as
implemented by the
/u95/bin/sh( )
shell.
See
ksh(1)
for more information on this shell.
The jobs utility displays the status of jobs that were started in the
current shell environment (see the description of set -m on the
ksh(1)
manual page).
When jobs reports the termination status of a job, the shell removes
its process ID from the list of those known in the current shell
execution environment.
See the ``Commands'' and ``Jobs'' subsections of the
ksh(1)
manual page for more information on asynchronous command execution
and job control.
Flags
The following options are supported:
-l-
Provide detailed information about each job listed.
This information includes the job number, current job, process
group ID, state and the command that formed the job.
-p-
Display only the process IDs for the process group leaders of
the selected jobs.
By default, the jobs command displays the status of all stopped
jobs, running background jobs and all jobs whose status has changed
and have not been reported by the shell.
Operands
The job_id parameter specifies the process ID of the job whose
status is to be displayed.
If no job_id operand is given, the status of all jobs is
displayed.
Environment variables
The following environment variables affect the execution of bg:
LANG-
Provide a default value for the internationalization variables that
are unset or null.
If LANG is unset or null, the corresponding value from the
implementation-specific default locale will be used.
If any of the internationalization variables contains an invalid
setting,
the utility will behave as if none of the variables had been defined.
LC_ALL-
If set to a non-empty string value, override the values of all the
other internationalization variables.
LC_CTYPE-
Determine the locale for the interpretation of sequences of bytes of
text data as characters (for example, single- as opposed to multi-byte
characters in arguments).
LC_MESSAGES-
Determine the locale that should be used to affect the format and
contents of diagnostic messages written to standard error.
Output
If the -p option is specified, the output consists of one
line for each process ID.
Otherwise, if the -l option is not specified, the output
is a series of lines of the form:
[job-number] current state command
where the fields are as follows:
job-number-
A number that can be used to identify the process group to the
wait(1),
fg(1),
bg(1),
and
kill(1)
utilities.
current-
The character ``+'' identifies the job that would be used as a
default for the fg or bg commands; this job can also
be specified using the job_id %+ or %%.
The character - identifies the job that would become the default
if the current default job were to exit; this job can also be
specified using the job_id %-.
For other jobs, this field is a space character.
At most one job can be identified with ``+''
and at most one job can be identified with -.
If there is any suspended job, then the current job will be a
suspended job.
If there are at least two suspended jobs, then the previous job
will also be a suspended job.
state-
One of the following strings (in the POSIX Locale):
Running
-
Indicates that the job has not been suspended by a signal and has not exited.
Done
-
Indicates that the job completed and returned exit status zero.
Done(
code)
-
Indicates that the job completed normally and that it exited with the
specified non-zero exit status, code, expressed as a decimal number.
Stopped (SIGTSTP)
-
Indicates that the job was suspended by the SIGTSTP signal.
Stopped (SIGSTOP)
-
Indicates that the job was suspended by the SIGSTOP signal.
Stopped (SIGTTIN)
-
Indicates that the job was suspended by the SIGTTIN signal.
Stopped (SIGTTOU)
-
Indicates that the job was suspended by the SIGTTOU signal.
Terminated
-
Indicates that the job was terminated by a SIGTERM signal.
signal
-
Indicates that the job was terminated by the indicated signal.
command-
The associated command that was given to the shell.
If the -l option is specified, a field containing the
process group ID is inserted before the state field.
Also, more processes in a process group may be output on separate
lines, using only the process ID and command fields.
Exit codes
An exit code of 0 indicates successful completion; an exit code
greater than 0 indicates an error.
Usage
Use the -p option to find out the process group of a job.
Usage such as
(jobs -p)
provides a portable way of referring to the process group of a job.
The jobs utility will not work as expected when it is operating in its own
utility execution environment because that environment will have no
applicable jobs to manipulate.
See the ``Usage'' subsection of
bg(1).
References
bg(1),
fg(1),
ksh(1)
© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 25 April 2004