4.4.2.7 Returning from a function, sourced file, or subshell (‘return’)

return

You can cancel execution of a function call or a subshell with the return command.

The return command does not resume execution; it leaves the program stopped in the state that would exist if the function had just returned. See also the quit command (Quitting the BASH debugger). In some situations return is similar to quit: in particular when the script is not currently inside in a function and the number of subshells in effect is 0, or when a subshell count of 1 is given on the quit command.

In contrast, the finish command (see Finish) resumes execution until the selected stack frame returns naturally.