May 2013
Beginner to intermediate
384 pages
7h 40m
English
Like any other scripting languages, Bash also supports functions. Let us see how to define and use functions.
We can create functions to perform tasks and we can also create functions that take parameters (also called arguments) as you can see in the following steps:
function fname()
{
statements;
}
Or alternately,
fname()
{
statements;
}
$ fname ; # executes function
fname arg1 arg2 ; # passing args
Following is the definition of the function fname. In the fname function, we have included various ways of accessing the function arguments.
fname() { echo ...Read now
Unlock full access