Hi!

Long time since i done any bash scripting.

Is it possible to pass a arguments in functions?

Something like:

recivefunc(SOMETHING)
{
echo $SOMETHING
}

passingfunc()
{
SOMETHING=test
recivefunc($SOMETHING)
}
receivefunc()
{
    echo $1
}
receivefunc()
{
    echo $1
}

I know how to catch arguments from terminal.

I guess its not possible to pass arguments from function to function in bash script like in ordinary programming language since i cant find any information about it.

Of course you can. They just don't have names. They are positional, and are referred as $1, $2, etc. The $1 used in a function is a first argument passed to it.

> since i cant find any information about

That's strange, because TFM clearly says:

When a function is executed, the arguments to the function become the positional parameters during its execution. The special parameter # is updated to reflect the change. Special parameter 0 is unchanged.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.