Changing a Job's State
A job can be moved from one state (foreground, background, or suspended) to any other state. The commands used to manipulate jobs are listed in Table 15-1; %
j
designates the job on which you wish to operate. fg, bg, kill, and stop can take multiple job specifier arguments, each of which is processed in turn. Table 15-2 shows the various forms that %
j
can take.
Table 15-1. Job Control Commands
Command | Effect of Command |
---|---|
| Stop the foreground job |
| Interrupt (terminate) foreground job |
| Bring stopped or background job to foreground |
| Move stopped job to background |
| Kill (terminate) stopped or background job |
| Stop background job |
| Suspend current shell (if non-login shell) |
| Display current job list |
Table 15-2. Job Specifiers
Specifier | Job to Which the Specifier Refers |
---|---|
| Current job ( |
| Previous job |
| Job number |
| Job whose command line begins with |
| Job whose command line contains |
You can often refer to a job more easily by name than by number, although %
str
and %?
str
are ambiguous if they match more than one job in your job list. When such a situation occurs, the shell provides warning. For example, our job list includes two jobs beginning with vi and two jobs containing reference.ms. As a result, the following commands are ambiguous:
%fg %vi
%vi: Ambiguous. %fg %?ref
%?ref: Ambiguous.
If you use %?
str
to refer to a job and the shell responds with No match
, the shell is interpreting the ?
as a pattern-matching ...
Get Using csh & tcsh now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.