On Thu, Jun 25, 2009 at 07:33:18PM -0400, Chet Ramey wrote: > Marc Weber wrote: > > > This is my point: I'd like to tell bash: Whenever running an executable > > assume that if it returns a non zero exit status that's a unforeseen > > exception. And in this case don't continue as usual but abort and return > > non zero exit status yourself. set -e comes close. > > You're talking about making bash exit when a command fails even when > not in a command execution context. The example above is a word > expansion context. `set -e' acts in a command execution context. > > Nor are you talking only about executables; you mean builtins too, > just to make that clear. > > Your proposal would have bash exit on > > echo `expr $var - 1` shrug. I didn't knew that either. I think that this is bad. expr should do some calculation. If the calculation fails (eg devision by zero) the return value should be non zero.
But yeah. You've just given me another example why you need deep active knowledge to write good scripts Maybe I should rather just use perl, python, ruby or php instead of continuing this thread then Marc Weber