exit shell script from a function

view story

http://unix.stackexchange.com – Consider this function: func () { exit 1 } Normally when this function is called will cause the script to terminate, which is the intended behaviour. However, if it's executed in a sub-shell, such as in result=`func` it will not exit the script. This means the calling code has to check the exit status of the function every time. Is there a way to avoid this? Is this what set -e is for? (HowTos)