I'm using sh (dash) on Ubuntu (lucid) and the manpage has this to say about -e:           -e errexit       If not interactive, exit immediately if any untested command fails.                            The exit status of a command is considered to be explicitly tested                            if the command is used to control an if, elif, while, or until; or                            if the command is the left hand operand of an && or || opera                            tor.What happens when a background command fails? And does bash behave differently in this respect?
How does sh -e interact with &?
bash;shell;background process;exit
It's quite simple to test this. With -e:% bash -e -c 'false & echo waiting; if wait $!; then echo success; else echo failure; fi'waitingfailureSo if a backgrounded command fails, the shell will not exit automatically (-e is not enough).If you wait outside an explicit test, wait will return the return code of the failed backgrounded process. In this case, if -e is specified, the shell will exit:% bash -e -c 'false & echo waiting; wait $!; echo returned'   waitingSame results with bash or sh or zsh.