On 8/10/11 5:59 PM, Linda Walsh wrote: > > Chet Ramey wrote: >> >> Yes. It's a case of not saving and restoring enough state across >> possibly- >> recursive calls to the shell parser. (The assignment statement is the >> key >> in this case.) >> >> > So, I compared subst.c files from bash-4.1-9 and bash-4.2-10 and was >> > able >> > to build a patch that it seems to make it work. >> > So to all you Bash guru's, can this patch be applied with no extra >> > consequences ? >> >> No. The code is in there for a reason. It's part of the fix for >> Posix >> interpretation 217 (http://austingroupbugs.net/view.php?id=217). >> >> The right fix is to save and restore the right shell context around >> recursive calls to the parser. The attached patch does that, and the >> result passes the rest of the test suite (which obviously needs to be >> augmented). > ---- > > Is this a fluke, due to the above changes NOT being 4.1? Or is this > construction going to break in 4.2: > > '$((( )))'
What does `break' mean? It's already written in a manner more confusing and obscure than necessary. What value do you think the extra set of parens adds? > > I wanted to evaluate something and assign result to a var. > > so: > a=$(((-48-16+2**6))) > gives me 'a=0', but And it does in bash-4.2 also, but why make things harder on yourself? If you feel you have to use a redundant set of parens, make the intent of the code clear: a=$(( (-48-16+2**6) )) > How do I assign something to a? With an assignment statement. -- ``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/