Download The UNIX programming environment
Transcript
The UNIX programming environment difference. The added bonus of the C-shell is that each shell has a job number in addition to its PID. The job numbers are simpler and are private for the shell, whereas the PIDs are assigned by the kernel and are often very large numbers which are difficult to to remember. When a command is executed in the shell, it is assigned a job number. If you never run any background jobs then there is only ever one job number: 1, since every job exits before the next one starts. However, if you run background tasks, then you can have several jobs "active" at any time. Moreover, by suspending jobs, C-shell allows you to have several interactive programs running on the same terminal -- the `fg' and `bg' commands allow you to move commands from the background to the foreground and vice-versa. Take a look at the following shell session. nexus% emacs myfile & [1] 4990 nexus% ( other commands ... , edit myfile and close emacs ) [1] Exit 70 emacs myfile When a background job is done, the shell prints a message at a suitable moment between prompts. [1] Done emacs myfile This tells you that job number 1 finished normally. If the job exits abnormally then the word `Done' may be replaced by some other message. For instance, if you kill the job, it will say unix% kill %12 [12] Terminated textedit file You can list the jobs you have running using the `jobs' command. The output looks something like [1] + Running [3] Running [4] Running [5] Running [6] Running [7] Running [8] Running [9] Running [10] Running [11] - Running [15] Suspended textedit c.tex textedit glossary.tex textedit net.tex textedit overview.tex textedit perl.tex textedit shell.tex textedit sysadm.tex textedit unix.tex textedit x11.tex shelltool emacs myfile To suspend a program which you are running in the foreground you can type CTRL-z (this is like sending a `kill -18' signal from the keyboard). (5) You can suspend any number of programs file:///C|/Dokumente und Einstellungen/The UNIX programming environment.htm (48 von 198)20.11.2004 11:29:42