traptrap
[ [commands
] signals
]trap -p
Execute commands if any signals are received. The second form is specific to ksh93 ; it prints the current trap settings in a form suitable for rereading later. Common signals include 0, 1, 2, and 15. Multiple commands should be quoted as a group and separated by semicolons internally. If commands
is the null string (i.e., If both commands and signals are omitted, list current trap assignments. See the Examples here and in exec . SignalsSignals are listed along with what triggers them:
Examplestrap "" 2 Ignore signal 2 (interrupts) trap 2 Obey interrupts again Remove a trap "rm -f $tmp; exit" 0 1 2 15 Print a "clean up" message when the shell program receives signals 1, 2, or 15: trap 'echo Interrupt! Cleaning up...' 1 2 15 |
|