Trap Notes in split format
Here are some notes about shell traps:
|
Here are some notes about shell traps:
|
|
= syntax =
* 'trap' - show a list of active trap handlers
* 'trap -l' - show a list of possible signals to trap (doesn't include ERR and EXIT)
* 'trap "<handler command>" <signal> [<signal2>...]' - set trap handler to indicated command
* 'trap - <signal> [<signal2]' - reset trap handler to default
|
|
= notes =
* with set -e, and an ERR handler set, the error handler runs, but the script still exits
* when err_handler exits, the script does it's EXIT routine
|
- entering a function clears the ERR trap handler
* fixable with "set -o errtrace"
* I can't seem to get traptest.sh to respond to SIGTERM
|
* entering a function clears the ERR trap handler
* fixable with "set -o errtrace"
* I can't seem to get traptest.sh to respond to SIGTERM
|