A shell function is a compound command that has been given a name. It stores a series of commands for later execution. The name becomes a command and can be used in the same way as any other command. Its arguments are available in the positional parameters, just as in any other script. Like other commands, it sets a return code.
A function is executed in the same process as the script that calls it. This makes it fast because no new process must be created. All the variables of the script are available to it without having to be exported, ...