(posted to blog comments as well)
If you decide to trap INT or TERM, it would be wise to properly kill your process with INT or TERM:
# if you're using bash, you can use $BASHPID in place of $$
for sig in INT TERM EXIT; do
trap "rm -f \"\$TMPFILE\"; [[ $sig == EXIT ]] || kill -$sig $$" $sig
done
Not propagating signals in this manner is being a bad Unix citizen. Bash would have re-raised the SIGNAL, so you should too.For more information: http://www.cons.org/cracauer/sigint.html