Passing global variable to a function which is called by another function

Hi ,

I have three funcions f1, f2 and f3 .
f1 calls f2 and f2 calls f3 .
I have a global variable "period" which i want to pass to f3 .
Can i pass the variable directly in the definition of f3 ?
Pls help .

sars

You can access the global variable directly in the function.

period="hi"
f3()
{
echo $period
}
f3

Ya ,
i was able to pass the global variable to the function .
Sorry for that dumb question .

how do i get a result in fraction in shell script.

I am using expr for division of two numbers but it is giving Quotient.

I need it in full fraction value.

Pls don't 'piggy-back' threads - start a new thread.
Also please read the Rules.