Hi Guys,
Is there a way to write a recursive function in unix?
Thanks for your help in advance,
Regards,
Magesh.
Hi Guys,
Is there a way to write a recursive function in unix?
Thanks for your help in advance,
Regards,
Magesh.
Yes, if by recursive you mean a function that calls itself, why not?
X=0
function Func1 {
echo X is $X
X=$((X + 1))
test $X -le 10 && Func1
}
Func1
--output--
X is 0
X is 1
X is 2
X is 3
X is 4
X is 5
X is 6
X is 7
X is 8
X is 9
X is 10