Re: bash subroutine syntax question



Bit Twister wrote:
On Fri, 31 Oct 2008 02:23:02 GMT, ToddAndMargo wrote:
I do not understand. When I pass arguments to the subroutine,
they come out as $1, $2, $3 ...

Can you give me an example of what you are speaking?

Some light reading found here http://tldp.org/LDP/abs/html/index.html


Hi Bit,

http://tldp.org/LDP/abs/html/functions.html

states:

function function_name {
command...
}
or

function_name () {
command...
}

This second form will cheer the hearts of C programmers
(and is more portable).

As in C, the function's opening bracket may optionally
appear on the second line.

function_name ()
{
command...
}


It does not state what goes in the (). Just that it will "cheer
the hearts of C programmers".

Any idea what goes in the (), or is it just window dressing
to cheer up "C" programmers?

Great reference by the way!

-T
.