c
csh(1) | csh(1) |
[1] 1234
indicating that the job which was started asynchronously was job number 1 and had one
If you are running a job and want to do something else, you can type the currently de®ned suspend character (see termio(7)) which sends a stop signal to the current job. csh then normally indicates that the job has been `Stopped', and prints another prompt. You can then manipulate the state of this job, putting it in the background with the bg command, run some other commands, and then eventually bring the job back into the foreground with the foreground command fg. A suspend takes effect immediately and is like an interrupt in that pending output and unread input are discarded when it is typed. There is a delayed suspend character which does not generate a stop signal until a program attempts to read(2) it. This can usefully be typed ahead when you have prepared some commands for a job which you want to stop after it has read them.
A job being run in the background stops if it tries to read from the terminal. Background jobs are normally allowed to produce output, but this can be disabled by giving the command stty tostop (see stty(1)). If you set this tty option, background jobs stop when they try to produce output, just as they do when they try to read input. Keyboard signals and
There are several ways to refer to jobs in the shell. The character % introduces a job name. If you wish to refer to job number 1, you can name it as %1. Just naming a job brings it to the foreground; thus %1 is a synonym for fg %1 , bringing job 1 back into the foreground. Similarly, typing %1 & resumes job 1 in the background. Jobs can also be named by pre®xes of the string typed in to start them if these pre®xes are unambiguous; thus %ex normally restarts a suspended ex(1) job, if there is only one suspended job whose name begins with the string ex. It is also possible to say %?string which speci®es a job whose text contains string, if there is only one such job.
csh maintains a notion of the current and previous jobs. In output pertaining to jobs, the current job is marked with a + and the previous job with a
%%is also a synonym for the current job.
csh learns immediately whenever a process changes state. It normally informs you whenever a job becomes blocked so that no further progress is possible, but only just before printing a prompt. This is done so that it does not otherwise disturb your work. If, however, you set the shell variable notify, csh noti®es you immediately of changes in status of background jobs. There is also a csh
If you try to leave the shell while jobs are stopped, csh sends the warning message: You have stopped jobs. Use the jobs command to see what they are. If you do this or immediately try to exit again, csh does not warn you a second time, and the suspended jobs are terminated (see exit(2)).
alias alias name alias name wordlist
The ®rst form prints all aliases. The second form prints the alias for name. The third form assigns the speci®ed wordlist as the alias of name. Command and ®le name substitution are performed on wordlist. name cannot be alias or unalias.
bg [ %job ... ]
Put the current (job not speci®ed) or speci®ed jobs into the background, continuing them if they were stopped.
break Causes execution to resume after the end of the nearest enclosing foreach or while. The remaining commands on the current line are executed.
Section 1−130 | − 2 − |