Re: Question about testing with variable operators
From:
Chet Ramey
Subject:
Re: Question about testing with variable operators
Date:
Sun, 12 Jun 2011 22:15:00 -0400
User-agent:
Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.17) Gecko/20110414 Lightning/1.0b2 Thunderbird/3.1.10
On 6/10/11 11:44 AM, Steven W. Orr wrote:
> As a work around, I can use eval or the builtin test, but my question is
> this: Is this a bug or is there a reason that it should work for arithmetic
> but not for the test [[ operator?
It's not a bug. The (( command is syntactic sugar: (( ...)) is exactly
the same as let "...", with the expansions and evaluation ordering that
implies.
The [[ compound command is part of the shell language, and the operators
must be available to the parser when the command is read.
Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU chet@case.edu http://cnswww.cns.cwru.edu/~chet/