trap, onintr — Shell Built-in Functions to Respond to Hardware Signals

Synopsis

sh
trap [argument n [n2...]] 
csh
onintr [-| label] 
ksh
* 
trap [arg sig [sig2...]] 

Description

Use the built-in shell trap and onintr commands in shell scripts to specify a sequence of commands to be executed when your shell script receives an interrupt signal.

Bourne Shell

The trap command argument is read and executed when the shell receives numeric or symbolic signal(s) (n ).

Note

argument is scanned once when the trap is set and once when the trap is taken.

Trap commands are executed in order of signal number or corresponding symbolic names. Any attempt to set a trap on a signal that was ignored on entry to the current shell is ineffective. An attempt ...

Get Solaris™ 7 Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.