I might know the answer to this, but I just want to see if any of you know any work arounds before I go and re-write the whole thing.
I have a script as follow:
Code:
$ cat testing
#! /usr/bin/ksh
f ()
{
echo "Type \"y\" \c"
read value
if [ "$value" = "y" ];
then
echo "Circular reference."
f
fi
echo "Running.."
}
f
As you can see, it has a circular reference to the function on which its call if I input a value of "y" when it ask me. And I execute it..
Code:
$ ./testing
Type "y" y
Circular reference.
Type "y" y
Circular reference.
Type "y" n
Running..
Running..
Running..
$
Which I expect to be "normal". Now, my question is, is there anyway, I can avoid this without re-writing the whole thing? I mean, can I, somehow especify to it it should "halt" its old executions when I tell it to jump again to the function.
Any help would be appreciated. If anyone has done any similar, I am open for suggestions.
Thanks!