First page Back Continue Last page Graphics
Signals and the TRAP statement
trap 'statement; statement; …' event-list
The trap statement list is read by the shell twice, first when it's set (it's set once only, before it is to be used, and stays active until you clear it).
It's read a second time when it's executed.
If you enclose the statement in single quotes, substitutions only take place at execution time.
If you use double quotes, substitutions will take place upon both readings.
If statement is omitted, the signals (use - (dash)) for all) are reset to the default.
If statement is a null (empty) string, the signals specified will be ignored.