trap 'handler' SIGINT

Category: Shell & Bash

trap 'handler' SIGINT

Catch Ctrl+C (SIGINT) and run a handler

Catches the Ctrl+C interrupt signal (SIGINT) and runs a handler instead of immediately terminating the script.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.