The C shell is not quite as sophisticated at handling signal
interruptions during script execution as the Bourne shell.
The C shell can handle signals in a very general way with the
onintr command.
By general it is meant that all signals are essentially handled the
same, which is unlike the way that trap works in the Bourne shell.
There are three ways in which to use the ointr command within a
script.
The first of these is simply
onintr
which will cause the script to terminate on any signal.
The second use of onintr
onintr -
works in the opposite manner by ignoring all signals, which might be
used to allow a script to clean up any files written during execution.
The third and last use of the onintr command is
onintr LABEL
which sends the script to LABEL to continue execution of
commands after that point.
Again, this could be used to remove any temporary files or write out
any last minute information to a file.
The execution of commands after LABEL will continue until
either an exit command or the end of the script, so an
exit command should be placed after the desired commands.
The C shell has another way of handling signal interruptions caused by
turning off a terminal or disconnecting a line to a remote terminal.
The nohup command (do not hangup) causes a command to continue
execution after a hangup.
Used on a command line nohup has the following form:
nohup COMMAND
The C shell provides an automatic nohup in the sense that any
commands or programs run in the background using the (&) (see
next section) will not be killed by a hangup signal (hup).
In a shell script, nohup will cause the remainder of the script
to run to completion, ignoring the hup signal.