bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: variable name and its' value are the same characters causes recursio


From: Chet Ramey
Subject: Re: variable name and its' value are the same characters causes recursion error
Date: Wed, 9 Mar 2011 17:06:19 -0500

> On 03/09/2011 02:54 PM, Chet Ramey wrote:
> >>
> >> For example:
> >>
> >> unset a; declare a="a"; [[ a -lt 3 ]]; echo $?
> >> bash: [[: a: expression recursion level exceeded (error token is "a")
> >> 1
> >>
> >> Shouldn't the return code from this expression be 2, rather than 1?
> > 
> > What does it matter?  Failure is failure.
> 
> Except that [[ explicitly documents that 0 and 1 imply a syntactically
> valid expression, reserving $?==2 for catastrophic failure.

Ummm...no, it doesn't.  It promises only to return 0 or 1, or 2 if a regular
expression is invalid.  You can try to make a case that the exit status
should change, but not on the basis of how it's currently documented.

-- 
``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/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]