ONINTR(1CSH) COMMAND REFERENCE ONINTR(1CSH)
NAME
onintr - interrupt handling (csh built-in)
SYNOPSIS
onintr [ - ]
onintr [ label ]
DESCRIPTION
The command onintr is used in shell scripts to handle
interrupts. If no arguments are given, the default
interrupt handling, which is usually to abort the program,
is restored. With the argument -, interrupts are ignored.
With a label argument, interrupts cause the command goto
label to be executed. Interrupts may either be received by
the shell or by a child process to be handled by the onintr
control.
If a shell is running detached and interrupts are being
ignored, onintr commands are ignored.
EXAMPLES
The following shell script builds a file from all files
named on the command line, and moves the file to the file
named by the environment variable OUTPUTFILE. The resulting
file contains no lines beginning with the character `#'.
The onintr command is used to abort the script if an
interrupt is received during the file building, and is used
to ignore interrupts during the file move.
#!/bin/csh -f
#
# First, make sure that the variable OUTPUTFILE is set.
#
if ($?OUTPUTFILE == 0) then
echo "$0 : OUTPUTFILE variable not set."
exit 1
endif
onintr abort
cp /dev/null /tmp/output.$$
foreach name ($argv)
grep -v '^#' "$name" >> /tmp/output.$$
end
onintr -
mv /tmp/output.$$ "$OUTPUTFILE"
exit
#
Printed 10/17/86 1
ONINTR(1CSH) COMMAND REFERENCE ONINTR(1CSH)
# Interrupt handling.
#
abort:
echo "$0 : Aborting. $OUTPUTFILE not updated."
exit 1
DIAGNOSTICS
onintr: Can't from terminal.
The onintr command can only be used in shell
scripts. This message occurs whenever onintr
is invoked from a terminal.
RETURN VALUE
[NO_ERRS] Command completed without error.
[1] The command was invoked from a terminal.
CAVEATS
In csh(1csh), only interrupts and hangups (see nohup(1csh))
can be ignored, and only interrupts can be caught. If more
control over signals is required, sh(1sh) should be used.
SEE ALSO
@(1csh), alias(1csh), bg(1csh), break(1csh), cd(1csh),
chdir(1csh), continue(1csh), csh(1csh), dirs(1csh),
echo(1csh), eval(1csh), exec(1csh), exit(1csh), fg(1csh),
glob(1csh), goto(1csh), hashstat(1csh), history(1csh),
jobs(1csh), kill(1csh), limit(1csh), logout(1csh),
nice(1csh), nohup(1csh), notify(1csh), popd(1csh),
pushd(1csh), rehash(1csh), repeat(1csh), set(1csh),
setenv(1csh), sh(1sh), shift(1csh), source(1csh),
stop(1csh), suspend(1csh), time(1csh), trap(1sh),
umask(1csh), unhash(1csh), unalias(1csh), unlimit(1csh),
unset(1csh), unsetenv(1csh), wait(1csh), which(1csh),
signal(3c).
Printed 10/17/86 2
%%index%%
na:72,96;
sy:168,187;
de:355,798;
ex:1153,1016;2313,148;
di:2461,364;
rv:2825,195;
ca:3020,286;
se:3306,1541;
%%index%%000000000143