trap

Execute a command upon an event. More information: https://www.gnu.org/software/bash/manual/bash.html#index-trap.

trap -l

trap -p

trap 'echo "Caught signal SIGHUP"' SIGHUP

trap - SIGHUP SIGINT