I was using \"exit 1\" statement in my bash functions to terminate the whole script and it worked fine:
function func()
{
echo \"Goodbye\"
exit 1
}
ech
A child process can't force the parent process to close implicitly. You need to use some kind of signaling mechanism. Options might include a special return value, or perhaps sending some signal with kill, something like
function child() {
local parent_pid="$1"
local other="$2"
...
if [[ $failed ]]; then
kill -QUIT "$parent_pid"
fi
}