On 8/9/11 8:10 PM, Linda Walsh wrote: >> The change to make (( honor the `errexit' option came in with bash-4.1, >> part of the cleanup after the Posix changes to the specification of the >> behavior of `set -e'. Most of the other changes in this area came in >> with bash-4.0. > ---- > I thought (()) was a bash extension?
It is. That's not a reason to make `set -e' apply non-uniformly. > > If so, why shoe-horn it into a 20y/o spec**? It's often used for > doing calculations -- that's why it was added... it can only be used > where a command can be used, so having it die whenever it evals to 0 -- just > doesn't make sense. If there's an error in the calculation, like division > by zero, sure, but just because I come up with a result of 0, == it's a far > stretch to think that would be an error. There are ways around this, if it's an issue. > Did you get bitten by some POSIX virus? That didn't end up being nearly as funny as you probably thought it was going to be. >> Posix changed set -e to cause the shell to exit when any command fails, >> not just when simple commands fail, as in versions of the standard up >> to and including Posix.1-2008. > --- > (()) isn't a command, it's a calculation (how's that for different > justification?) Creative, but it's a command. >>> 2) a function returning a false value -- Tried putting the ((expr)) in >>> an if: >>> >>> if ((expr)); then return 0; else return 1; >>> >>> As soon as it sees the return 1, it exits, -- as I returned 'false' >>> (error). > ---- > It was followed by an &&, has that changed too? It's impossible to say what the problem, if any, might have been. For instance, the following script displays `after': set -e func() { if (( 0 )); then return 0; else return 1; fi } func && echo a echo after > ** -- wait, I thought posix was dead ages ago....there are updates? 2008? > is that > the latest? #*(@#$()@#)!@)*&% they whole reason for the standard was so > programs > wouldn't keep breaking...and now they change the standards... Maybe you should read it; you'll see that work is continuing. http://pubs.opengroup.org/onlinepubs/9699919799/nfindex.html We're about to ballot on Technical Corrigendum 1 (TC1) to the 2008 version. Chet -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, ITS, CWRU c...@case.edu http://cnswww.cns.cwru.edu/~chet/