Job control in the C shell
The shell associates a job number with each process. The shell keeps a table of current jobs and assigns them small integer numbers.
&
) , the shell prints a line that looks like the following:[1] 1234
This line indicates that the job number is 1
and that the
job is composed of a single process with a process ID of 1234
. Use the built-in
jobs command to see the table of current
jobs.
A job running in the background competes for input if it tries to read from the workstation. Background jobs can also produce output for the workstation that gets interleaved with the output of other jobs.
%
) character to introduce a job name. This
name can be either the job number or the command name that started the job,
if this name is unique. For example, if a make process
is running as job 1, you can refer to it as %1
. You can also
refer to it as %make
if there is only one suspended job with
a name that begins with the string make
. You can also use
the following:%?String
to specify a job
whose name contains the String variable, if there is only
one such job.The shell detects immediately whenever a process changes its state. If a job becomes blocked so that further progress is impossible, the shell sends a message to the workstation. This message displays only after you press the Enter key. If, however, the notify shell variable is set, the shell immediately issues a message that indicates changes in the status of background jobs. Use the built-in notify command to mark a single process so that its status changes are promptly reported. By default, the notify command marks the current process.