The trap command can catch various signals in a Bash script. Common signals that can be caught include:
SIGINT(2): Triggered by pressing Ctrl+C.SIGTERM(15): Default termination signal.SIGHUP(1): Sent when the terminal is closed.SIGQUIT(3): Triggered by pressing Ctrl+.
You can specify which signals to catch in the trap command by listing them. For example:
trap 'echo "Caught SIGINT"' SIGINT
This command will execute the specified action when the SIGINT signal is received. You can catch multiple signals by separating them with spaces.
