#/bin/sh
# Scriptname: trapping
# Script to illustrate the trap command and signal
trap 'echo "CtrlC will not interupt this process
trap 'echo "CtrlD will not terminate this process
echo "Enter any string after the prompt."
echo "When you are ready to
exit, type \
"stop\"." while true
do
echo n "Go ahead...> "
read reply
if [ "$reply" = stop ]
then
break
if
done
Iy9iaW4vc2gKICAgICAjIFNjcmlwdG5hbWU6IHRyYXBwaW5nCiAgICAgIyBTY3JpcHQgdG8gaWxsdXN0cmF0ZSB0aGUgdHJhcCBjb21tYW5kIGFuZCBzaWduYWwgICAgCgkgCgl0cmFwICdlY2hvICJDdHJsQyB3aWxsIG5vdCBpbnRlcnVwdCB0aGlzIHByb2Nlc3MKCiAgICB0cmFwICdlY2hvICJDdHJsRCB3aWxsIG5vdCB0ZXJtaW5hdGUgdGhpcyBwcm9jZXNzCgogICAgZWNobyAiRW50ZXIgYW55IHN0cmluZyBhZnRlciB0aGUgcHJvbXB0LiIKICAgICBlY2hvICJXaGVuIHlvdSBhcmUgcmVhZHkgdG8gZXhpdCwgdHlwZSBcInN0b3BcIi4iCiAgICB3aGlsZSB0cnVlCiAgICAgZG8KICAgICAgICAgZWNobyAgbiAiR28gYWhlYWQuLi4+ICIKICAgICAgICAgcmVhZCByZXBseQogICAgICAgIGlmIFsgIiRyZXBseSIgPSBzdG9wIF0KICAgICAgICAgdGhlbgogICAgICAgICAgYnJlYWsKICAgICAgICAgaWYKZG9uZQo=