Operating System - HP-UX
1833704 Members
2510 Online
110062 Solutions
New Discussion

problem with exiting from function

 
Shabu Khan-2
Frequent Advisor

problem with exiting from function


I've done this so many times in the past with no problems, not sure if this has to do with the linux host that I am running on ... but thought I'll post it here.

I've multiple functions:
function1()
{
processing ....
if something; then
echo ...
exit 0
fi

}
similar ...

if [ ${#} -eq "3" ]; then
do this ...
call function1
call function2
elif....
.....
function1
function3
........
........

function1 does not exit even though I've an exit statement, it comes back to where I called from and processes the next function which shouldn't happen right?

any thoughts?
2 REPLIES 2
Shabu Khan-2
Frequent Advisor

Re: problem with exiting from function


what I meant was I want the script to exit, so basically quit while encountering a particular scenario while in function1 ...

Thanks,
Shabu
Shabu Khan-2
Frequent Advisor

Re: problem with exiting from function

sorry, my bad, I was tee'ng a function that was throwing me off ...
closing the thread.

Thanks,
Shabu