How can a bash code do a return completely while in nested call

How can a bash code do a return completely (as if it returns from main function) when it is being in a third nested function call, in order to get back to shell prompt at once ?

the function invocation is one which will fully shut down terminal if exit command is given.

tried so many times in vain, one of them:

c(){
local p
#...

[ "$p" = err ] && kill $TID

#...
}

b(){
#...
c
#...
}

a(){
export TID=$$
#...

b
#...
#...
}
Sincere help is thanked
maybe you can exploit these ideas to exit the script?
http://www.davidpashley.com/articles/writing-robust-shell-scripts.html
Some of the advice on that site is good (you almost always want to quote your variables), but I'd be wary about most of it. Namely, the use of set -e, and this loop:

 
for file in $(find /var/www-tmp -type f -name "*.html"); do


Is there a reason you can't just do something like:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
c() {
  # ...
}

b() {
  # ...
  c
  return
  # ...
}

a() {
  # ...
  b
  return
  # ...
}


You can also do something like
1
2
3
4
5
if c; then
  return
else
  # error
fi


Also, as a side note, there isn't really any reason to export TID, at least not in the code you've shown so far.
Registered users can post here. Sign in or register to post.