> Would it not be simple to add some kind of protection against this

As already mentioned, recursion is a perfectly valid programming
technique so you really cannot forbid it (in fact it is equivalent to
iteration <http://en.wikipedia.org/wiki/Recursion_(computer_science)>

Would you also forbid a shell function to call itself?


What you really want is proving termination. Unfortunately this is a
research topic <http://en.wikipedia.org/wiki/Termination_analysis>

Insanely dynamic languages like Unix shell scripting are the most
ill-suited for trying to prove anything.


> say don't let a script call itself more than 100 times?

Yes, in many environment you can configure a maximum recursion level
after which the program gone wild is killed. In your case "ulimit"
might help.



Reply via email to