recursion too deep


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting recursion too deep
# 1  
Old 07-18-2005
Error recursion too deep

I am running a korn shell script which has a recursive function.
The script ran for 117 iterations and ended up with the following error
"recursion too deep".
what should be done to avert this?
Thanks in advance
Swamy
p.s. I am on UNIX MPRAS V4
# 2  
Old 07-18-2005
check your 'end of recursion' condition - you maybe running into the 'infinite' recursion.
# 3  
Old 07-18-2005
This shell script checks for existence of a file.

psuedo code
-------------------------------------------------
function chk_for_file

if(file)
then do some thing
exit
else sleep for some time and call chk_for_file again
-------------------------------------------------
Thanks
Swamy
# 4  
Old 07-18-2005
Why are you recursing?

There is absolutely no need to do so, and if the file never exists you are indeed in an infinte loop.

Code:
function chk_for_file
{
while [[ ! -f file ]] ; do
     sleep <some number of seconds>
done

<do whatever>
}

Login or Register to Ask a Question

Previous Thread | Next Thread

4 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Finding files deep in directories

i need to find a portable way to go through multiple directories to find a file. I've trid something like this: find /opt/oracle/diag/*/alert_HH2.log -printordinarily, i can run the ls command and it will find it: /opt/oracle/diag/*/*/*/*/alert_HH2.log The problem with this approach is... (3 Replies)
Discussion started by: SkySmart
3 Replies

2. Programming

Deep copy of structure in C

Hi , I have a scenario where i need to copy the iter to another local variable , where iter is of type MCC_T_SYS_ADDRINFO *iter . struct addrinfo { int ai_flags; int ai_family; int ai_socktype; int ai_protocol; ... (5 Replies)
Discussion started by: breezevinay
5 Replies

3. Shell Programming and Scripting

[Solved] Perl, Deep recursion? exit() ignored?

Hi all, I am calling a subroutine which checks if a log file is writeable and if not, prints something stdout and also log something into the same file, which doesn't work neither of course. Anyway, there is enough exit() calls, that should stop it working, but the problem is, that I get the... (5 Replies)
Discussion started by: zaxxon
5 Replies

4. UNIX for Dummies Questions & Answers

I need to ls all files in 4-6 deep dirs

I need to print to file , a listing of all files below a certain directory. Example: I need to print to file a listing of all files below the etc dir (including the subdirectories) with their full path. Any ideas on how to do this with one command. Or is this something I need to do on all... (4 Replies)
Discussion started by: gforty
4 Replies
Login or Register to Ask a Question