== A gotcha with the Bourne shell's _set -e_ and _&&_ Suppose that you have the following Bourne shell code: > set -e > cmd1 && cmd2 && cmd3 > echo all done Now suppose that _cmd2_ exits with a non-zero status. Do you expect the script to abort, or to print out 'all done'? My assumption when I was writing a script recently was that the script would abort; after all, I had _set -e_ turned on. But this is not what happens, and in fact most Bourne shell manpages spell it out explicitly; _set -e_ only exits if what fails is a simple command that is *not* having its exit status tested. Everything except the final command in a series of _&&_'s is having its exit status tested, so failure of _cmd2_ here merely causes _cmd3_ not to be run. (Different Bourne shell implementations use different wording about the exact conditions, but I suspect that they behave the same. See [[the Single Unix Specification description of _set_ http://www.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#set]] for perhaps the authoritative wording on it.) If you are writing shell scripts, the immediate consequence of this is that it is not entirely safe to start out writing a script with various coded error checks and then later decide that you always want things to just exit on errors and add a _set -e_ to handle it all; you may find that your script is not aborting when you want it to, or alternately that the script's failure to abort is quietly hiding the fact that a single command did fail and that something else didn't get run.