1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-04-21 22:22:07 +02:00
tldr/pages/common/return.md
Lena 6fd816e36e
pages/*: use lowercase n for integer placeholders (#16033)
Co-authored-by: K.B.Dharun Krishna <kbdharunkrishna@gmail.com>
2025-03-27 21:23:12 +05:30

349 B

return

Exit a function or a script if run with source. 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}}; }