mirror of
https://github.com/ivuorinen/cheatsheet-tldr.git
synced 2026-01-26 11:33:59 +00:00
20 lines
478 B
Plaintext
20 lines
478 B
Plaintext
---
|
|
syntax: markdown
|
|
tags: [tldr, common]
|
|
source: https://github.com/tldr-pages/tldr.git
|
|
---
|
|
# 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}}; }`
|