construct

Bash function definition

Defines a reusable function without running its body. A normal brace-bodied call executes in the current shell.

Formal Syntax & Structure

bash syntaxbash
name() { commands; }

Return Value

exit status

Defines a reusable function without running its body. A normal brace-bodied call executes in the current shell.

Working Example

Example Snippetbash
greet() {  printf '%s\n' hello}printf '%s\n' readygreetgreet
Bash Reference