> 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 c...@case.edu http://cnswww.cns.cwru.edu/~chet/