Function
Try it yourself →Defines your own command.
Syntax
name() { ... }Description
Parameters are accessed with $1, $2 ... 'Returns' with echo (actual return code is return).
Example
greet() {
echo "Hello $1"
}
greet "Alex"Expected output
Hello Alex
When to use?
Preventing code repetition.