return

Exit a function with the return value specified by n.

Syntax
      return [n]

Key
   n   The value to return

If n is omitted, the return status is that of the last command executed in the function body.

If used outside a function, but during execution of a script by the . (source) command, it causes the shell to stop executing that script and return either n or the exit status of the last command executed within the script as the exit status of the script.

If used outside a function and not during execution of a script by ., the return status is false.

Any command associated with the RETURN trap is executed before execution resumes after the function or script.

return is a bash builtin command.

Related:

set - Set a shell variable = value



Back to the Top

© Copyright SS64.com 1999-2012
Some rights reserved