On Fri, Aug 12, 2011 at 12:19:59PM -0700, Linda Walsh wrote: > Under -e, it would fail on the 'let' statement
This is one of the cases I mention on http://mywiki.wooledge.org/BashFAQ/105 > "-e" -- in a ****WELL DESIGNED PROG***, where errors are caught, > shouldn't cause a otherwise working program to fail. In my opinion, a well-designed program will not use set -e. We're going to have to "agree to disagree" about this apparently. > The statements: > > ((a=0)) > > and > > let a=0 > > are both assignment statements (not 'commands') I was going to just let this drop, until I saw this part. This is simply incorrect, and can't be ignored. ((a=0)) is *not* an assignment. It is an arithmetic command. More specifically, it is documented in the bash manual under Compound Commands, with this description: ((expression)) The expression is evaluated according to the rules described below under ARITHMETIC EVALUATION. If the value of the expression is non-zero, the return status is 0; otherwise the return status is 1. This is exactly equivalent to let "expression". So, it is a command -- a compound command. It does what the manual says it does. It is not, however, an *assignment*, which is a very specific, different, thing. Assignments are defined here: http://pubs.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap04.html#tag_04_21 a=$((0)) is an assignment. ((a=0)) is not.