On 8/1/11 4:41 AM, dnade....@orange-ftgroup.com wrote: > Hello > > I wanted to check a variable before attempting to divide something by it, so > I wrote : > > echo $(( foo==0?0:something/foo )) > > And bash 2, 3 and up to 4.2.10 version sent me a "division by 0" error. > > So, I've tested a static version of the statement : > > $ echo $(( 0==0?0:1/0 )) > -bash: 0==0?0:1/0 : division by 0 (error token is " ") > > It looks like the "division by 0" happens whatever the condition result. > Shouldn't it happen only if condition result make the computing go that far > (like, FWIW, in zsh) ?
Hmm...this looks like a precedence problem. I'll take a look. 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/