ttrraapp -- Command

Execute command on receipt of signal
ttrraapp [_c_o_m_m_a_n_d] [_n ...]

The command ttrraapp tells the shell to execute _c_o_m_m_a_n_d when it receives signal
_n.

You can name more than one signal on the command line for ttrraapp. Each signal
_n is an integer, as defined in the header file ssiiggnnaall.hh. For information on
the traps that COHERENT recognizes and what each one means, see the Lexicon
entry  for the  system call  ssiiggnnaall().  If _n  is zero,  the shell  executes
_c_o_m_m_a_n_d when it exits.

If you name  no _c_o_m_m_a_n_d on the command line  for ttrraapp, then ttrraapp resets the
trap  for signal  _n to  its original  value.  If _c_o_m_m_a_n_d  is a  null string
(i.e.,  the string  ""), the  shell  traps signal  _n but  does nothing;  in
effect, this turns off signal _n.

If  you invoke  ttrraapp with  no arguments,  it prints  the signal  number and
associated command for each signal for which a trap has been set.

The shell executes ttrraapp directly.

_E_x_a_m_p_l_e
The following  example takes two  files and outputs only  those lines which
are the same.

# If input only one file-name then simply "cat".
if [ $# = 1 ]; then
    cat $1
    exit 0

# If input two file-names - Ok, else "Usage".
else
    if [ $# != 2 ]; then
        echo "Usage: cmn file1 [file2]"
        exit 1
    fi
fi

# TMP is original name of temporary file (/tmp/temp_(pid)
TMP=/tmp/temp_$$

# Temporary file has to be removed
trap 'rm $TMP; exit 1' 1 2 9

# Difference between "file1" and "difference between file1 and file2"
# is the common strings "file1" and "file2"
# The strings that are in "file1" and absent in "file2" print in TMP.
diff $1 $2 | sed -n -e "s/^< //p" > $TMP

# The strings that are in "file1" and absent in TMP print in stdout.
diff $1 $TMP | sed -n -e "s/^< //p"

# Remove temporary file
rm $TMP

_S_e_e _A_l_s_o
ccoommmmaannddss, kksshh, sshh, ssiiggnnaall()
