mirror of
https://github.com/ivuorinen/cheatsheet-tldr.git
synced 2026-01-26 11:33:59 +00:00
26 lines
522 B
Plaintext
26 lines
522 B
Plaintext
---
|
|
syntax: markdown
|
|
tags: [tldr, common]
|
|
source: https://github.com/tldr-pages/tldr.git
|
|
---
|
|
# function
|
|
|
|
> Define a function.
|
|
> More information: <https://www.gnu.org/software/bash/manual/bash.html#Shell-Functions>.
|
|
|
|
- Define a function with the specified name:
|
|
|
|
`function {{func_name}} { {{echo "Function contents here"}}; }`
|
|
|
|
- Run a function named `func_name`:
|
|
|
|
`func_name`
|
|
|
|
- Define a function without the `function` keyword:
|
|
|
|
`{{func_name}}() { {{echo "Function contents here"}}; }`
|
|
|
|
- Display help:
|
|
|
|
`help function`
|