#!/bin/ksh
# Script name: trapping
# Example 10.130

# Script to illustrate the trap command and signals
# Can use the signal numbers or Ksh abbreviations seen
# below. Cannot use SIGINT, SIGQUIT, etc.

PROGRAM=$0
trap 'print "Control-C will not terminate $PROGRAM."' INT
trap 'print "Control-\ will not terminate $PROGRAM."' QUIT
trap 'print "Control-Z will not terminate $PROGRAM."' TSTP
print "Enter any string after the prompt."
print "Also try CTL-C, CTL-\ and CTL-Z."
print "When you are ready to exit, type \"stop\"."
while true
do
    print -n "Go ahead...> "
    read
    if [[ $REPLY = [Ss]top ]]
    then 
	break
    fi
done
