On 3/10/11 8:14 AM, Greg Wooledge wrote:
> On Thu, Mar 10, 2011 at 10:18:26AM +0800, Clark J. Wang wrote:
>> Actually I don't like the recursion here. Does POSIX require that?
>>
>>> For example:
>>>
>>> unset a; declare a="a"; [[ a -lt 3 ]]; echo $?
>>> bash: [[: a: expression recursion level exceeded (error token is "a")
>>> 1
>
> POSIX doesn't even have a [[ command. This is all bash.
Not really. There is substantial agreement among shells that implement
arithmetic expansion. bash, ksh93, zsh, mksh (and other pdksh derivatives
that implement `[[') all behave the same way. For the most part, it's the
same way with `['; zsh is a notable exception there.
Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU [email protected] http://cnswww.cns.cwru.edu/~chet/