Function is series of instruction/commands.
Function performs
particular activity in shell i.e. it had specific work to do or simply say
task. To define function use following syntax:
Syntax:
function-name ( )
{ command1
command2 ..... ...
command N
return }
Where function-name is name of the function, that executes series of
commands.
A return statement will terminate the function.
Example:
Type SayHello() at $ prompt as follows
$ SayHello()
{
echo "Hello $LOGNAME, Have nice computing"
return
}
To execute this SayHello() function just type it name as follows:
$ SayHello