Le 10/12/2010 16:19, Dominic Raferd a écrit : > Thanks Greg (and also Eric and Andreas). Your FAQ makes it very clear; > that is to say, it makes it clear how darned complicated it is. Seems > best to avoid using 'set -e' altogether, as you say (except perhaps at > an early stage for debugging): point taken.
I use set -e almost systematically in non-trivial code and I am very happy with it. Except in extremely rare cases, when I accidentally forget to append "|| true" after... let. This is still far less annoying than having scripts that keep running after a failure. Or having to append "|| die" after each command. If you are really too afraid to use it in production it can still prove useful like this: if $DEBUG_MODE; then set -e fi Following a number of discussions on this list, I feel like the majority of highly respected experts here who regularly warn against set -e have never seriously tried to use it on a large scale. Le 10/12/2010 15:54, Eric Blake a écrit : > Remember, non-zero status is NOT always 'failure'; it is the > documentation of each command that will tell you which status values > imply failure. I do not find this to be a problem in practice: except for "let" the exit status is very intuitive for practically every command.