consider two methods in a script as below,

do_a()
{
spool $file1
select column1 from table1;
}

do_b()
{
spool $file2
select column1 from table2 where column2='xxxxx'
}

The first method returns just one value say 10001,I have to use this result in the second method in place xxxxx.
I used to call the method as

do_a >> ${outfile}
do_b >> ${outfile}

tell me how to get the arguments from method1 and pass it to method2.

Hey There,

The simplest way would be to have the first method/function return the result:

return 10001 - or return $variable

Then call method/function 2 with the return variable from method/function 1 as its argument.

do_b 10001 - or do_b $variable

Depending on how your shell scopes it could be as simple as that or you may have to "eval" the inital function/method as an argument to your second.

, Mike

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.