First page Back Continue Last page Graphics
Signals and the TRAP statement
To set a trap for SIGINT:
trap 'statement; statement; …' INT
trap INT
To prevent any SIGINT handling (ignore signals):
trap " " INT
Be cautious in trapping SIGINT: how will you stop a run-away script?
To see what traps are set (you can see traps for specific events by listing the names or numbers):
trap -p
To list the names for signals 1 to SIGRTMAX:
trap -l # that's an ell, not a one