Dear All,
I am trying to write a script which has 2 functions. I need to pass the final value of function 1 to function 2. Not sure how should I pass the value of one fucntion to another. Any help is very much appreciated.
I have tried putting the below little code, where I want to see the output "Hi" 5 times, I want to pass the value of "a" from func_one to func_two when the func_two should stop.
It could be a very simple one for who know scripting well, but unfortnately I am not one among them
____________________________________________________
#!/usr/bin/ksh
func_one()
{
for j in 1 2 3 4 5
do
a=$j
func_two
done
}
func_two()
{
while test "$a" -le "5"
do
echo "Hi"
done
}
func_one
____________________________________________________
TIA
KPKIND
I am trying to write a script which has 2 functions. I need to pass the final value of function 1 to function 2. Not sure how should I pass the value of one fucntion to another. Any help is very much appreciated.
I have tried putting the below little code, where I want to see the output "Hi" 5 times, I want to pass the value of "a" from func_one to func_two when the func_two should stop.
It could be a very simple one for who know scripting well, but unfortnately I am not one among them
____________________________________________________
#!/usr/bin/ksh
func_one()
{
for j in 1 2 3 4 5
do
a=$j
func_two
done
}
func_two()
{
while test "$a" -le "5"
do
echo "Hi"
done
}
func_one
____________________________________________________
TIA
KPKIND