Bash - Exit Builtin command


exit is a builtin command and cause the shell to exit with a given exit status.


exit [n]

If n is omitted,the exit status is that of the last command executed.

Post function

A function can be called on a EXIT before the shell terminates.

Example: by calling the exit function, the following finish function will run thanks to the registration of the function via the trap utility

function finish {
  # Your cleanup code here
trap finish EXIT

Documentation / Reference

Powered by ComboStrap