Linux and Unix trap and onitr command

Quick links

About trap, onintr
Syntax
Examples
Related commands
Linux and Unix main page

About trap and onintr

Shell built-in functions to respond to (hardware) signals.

Syntax

trap [ argument n [ n2] ]

onintr [ -| label ]

Examples

trap 'rm -f /tmp/xyz$$; exit' ERR EXIT

On error or exit delete a temporary file created during command execution.

Related commands

csh
exit
ksh
sh