First page Back Continue Last page Graphics
Signal-like events and TRAP
The EXIT event (also "signal" 0) occurs upon exit from the current shell.
The DEBUG event takes place before every simple command, for command, case command, select command, and before the first command in a function. See also the description of extdebug for the shopt built-in for details of its effect.
The ERR event takes place for each simple command with a non-zero exit status, subject to these conditions: it is not executed if the failed command is part of a while, until, or if condition expression, or in a && or || list, or if the command’s return value is being inverted via !. See also errexit for details.
The RETURN event occurs each time a shell function or a script executed with the . (that's a dot) or source built-in returns to its caller.