If I understand what you are saying,
exiting WILL pass control back to your calling shell (or program).
Code:
#----- prog1 ------
echo "Calling prog2 from prog1..."
prog2
echo "Back in prog1"
#----- prog2 ------
function prog2Func
{
echo "In prog2Func"
exit 1
}
echo "In prog2"
prog2Func
echo "You will not see this text!"
If you wanted simply to exit the function but to remain in prog2, use
return.
Damian