Command Reference Guide

__________________________________________________________________________________________________________________________________________________________________________________________________
__________________________________________________________________________________________________________________________________________________________________________________________________
STANDARD Printed by: Nora Chuang [nchuang] STANDARD
/build/1111/BRICK/man1/!!!intro.1
________________________________________________________________
___ ___
c
csh(1) csh(1)
[1] 1234
indicating that the job which was started asynchronously was job number 1 and had one (top-level) process,
whose process id was 1234.
If you are running a job and want to do something else, you can type the currently defined suspend charac-
ter (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.Asuspend 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 line-hangup signals from the terminal interface are not sent to
background jobs on such systems. This means that background jobs are immune to the effects of logging
out or typing the interrupt, quit, suspend, and delayed suspend characters (see termio(7)).
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 prefixes of the string typed in to start them if these prefixes
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 specifies 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 -. The abbreviation %+ refers to the current job and
%-
refers to the previous job. For close analogy with the syntax of the history mechanism (described below),
%% 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
notifies you immediately of changes in status of background jobs. There is also a csh built-in command
called
notify which marks a single process so that any status change is immediately reported. By
default, notify marks the current process. Simply type notify after starting a background job to
mark it.
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)).
Built-In Commands
Built-in commands are executed within the shell without spawning a new process. If a built-in command
occurs as any component of a pipeline except the last, it is executed in a subshell. The built-in commands
are:
alias
alias
name
alias name wordlist
The first form prints all aliases. The second form prints the alias for name. The third form
assigns the specified wordlist as the alias of name. Command and file name substitution are
performed on wordlist. name cannot be alias or unalias.
bg [%job ...]
Put the current (job not specified) or specified 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. Multi-level breaks are thus possi-
ble by writing them all on one line.
Section 1130 2 HP-UX Release 11i: December 2000
___
___