Files
tldr/pages/common/return.md
T
2025-12-16 10:33:24 +02:00

385 B

return

Exit a function. Can exit out of a script if run with source. See also: exit. More information: https://www.gnu.org/software/bash/manual/bash.html#index-return.

  • Exit a function prematurely:

{{func_name}}() { {{echo "This is reached"}}; return; {{echo "This is not"}}; }

  • Specify the function's return value:

{{func_name}}() { return {{exit_code}}; }