On Thu, Mar 10, 2011 at 5:14 AM, Peggy Russell <prusselltechgr...@gmail.com>wrote:
> > The existing documentation seems pretty clear: > > ... > > The value of a variable is evaluated as an arithmetic expression when > > it is referenced, or when a variable which has been given the integer > > attribute using declare -i is assigned a value. A null value evaluates > > to 0. A shell variable need not have its integer attribute turned on > > to be used in an expression. > > Hi Chet, > > I've reread that paragraph a number of times. It could be improved to > help the end-user. > > After the sentence: > > "The value of a variable is evaluated as an arithmetic expression > when it is referenced, ..." > > Add the sentence: > > This evaluation of the variables value will be performed > recursively until an arithmetic evaluation is found or > the expression recursion level exceeded. > > 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 > > Shouldn't the return code from this expression be 2, rather than 1? > > Thank you. > Peg > > > -- Clark J. Wang