There aren't really different "modes" of exiting. `exit 0` is simply explicitly setting the return code to the default of `0`. Which is to say that `exit` and `exit 0` are functionally identical; similar to the 'difference' between `ls` and `ls .`. Using a number other than 0 is simply doing the same thing: setting the return code to the specified value (or, absent specification, the default of zero). When a script ends without an `exit` instruction, the exit code of the final command executed by the command is used. If you `trap '[...]' EXIT`, and include an `exit` statement in the trap, it will supercede this as the trap will be executed (including any included `exit` commands) before the script actually terminates.