[ Previous | Next | Contents | Glossary | Home | Search ]
AIX Version 4.3 System User's Guide: Operating System and Devices

Job Control in the C Shell

The shell associates a job number with each process. It keeps a table of current jobs and assigns them small integer numbers. When you start a job in the background with an & (ampersand), the shell prints a line that looks like:

[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.

There are several ways to refer to jobs in the shell. Use the % (percent) 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. So, 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:


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 state. If a job becomes blocked so that further progress is impossible, the shell sends a message to the workstation. This message is displayed 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.

[ Previous | Next | Contents | Glossary | Home | Search ]