Trap_Notes 

Fuego 1.0 wiki

Login

Trap Notes

Here are some notes about shell traps:

syntax [edit section]

  • '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 [edit section]

  • 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

TBWiki engine 1.9.2 by Tim Bird