2.4.35. trap#

trap runs a command when a shell script receives a selected signal.

2.4.35.1. Common trap usage#

Here, trap executes rm if it receives any of the three listed signals:

trap "rm $TEMP_FILE; exit" SIGHUP SIGINT SIGTERM