SixArm/unix-shell-script-tactics

Trap exit: exit is a builtin funtion

Closed this issue · 1 comments

In the “Trap signals and exit” document, the function exit() is used, but exit is already a builtin command. Please use die() or cleanup(), or similar.

If exit() is indeed used, the result depends on the shell used:

  • bash: exit() is called
  • dash: Syntax error: Bad function name
  • ksh: exit: invalid function name
  • mksh: function not called
  • mrsh: function not called
  • posh: function not called
  • yash: function not called
  • zsh: function not called

Thank you, good catch. You're correct. The function should be named "trap_exit". I fixed it now.