bash functions

This is a wiki page. Be bold and improve it!

If you have any questions about the content on this page, don't hesitate to open a new ticket and we'll do our best to assist you.

A simple bash function:

#!/bin/bash

myfunction() {
    echo "This is my function."
}

myfunction

The function must be declared before its invocation.

See: "3.3 Shell Functions":
http://www.gnu.org/software/bash/manual/bash.html#Shell-Functions

#!/bin/bash

myfunction() {
    echo "This is my function."
}

myfunction

# Use of parameters:
my_print_function () {
   echo $1
}


my_print_function "Hello."

See: "3.4 Shell Parameters":
http://www.gnu.org/software/bash/manual/bash.html#Shell-Parameters