[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: |
Clark J. Wang |
Subject: |
Re: variable name and its' value are the same characters causes recursion error |
Date: |
Thu, 10 Mar 2011 10:16:42 +0800 |
On Thu, Mar 10, 2011 at 5:14 AM, Peggy Russell
<prusselltechgroup@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.
>
>
Agree. I didn't know it's recursive before. :)
> 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
- variable name and its' value are the same characters causes recursion error, Peggy Russell, 2011/03/07
- Re: variable name and its' value are the same characters causes recursion error, Chet Ramey, 2011/03/07
- Re: variable name and its' value are the same characters causes recursion error, Peggy Russell, 2011/03/07
- Re: variable name and its' value are the same characters causes recursion error, Chet Ramey, 2011/03/09
- Re: variable name and its' value are the same characters causes recursion error, Peggy Russell, 2011/03/09
- Re: variable name and its' value are the same characters causes recursion error, Chet Ramey, 2011/03/09
- Re: variable name and its' value are the same characters causes recursion error, Eric Blake, 2011/03/09
- Re: variable name and its' value are the same characters causes recursion error, Chet Ramey, 2011/03/09
- Re: variable name and its' value are the same characters causes recursion error,
Clark J. Wang <=
- Re: variable name and its' value are the same characters causes recursion error, Clark J. Wang, 2011/03/09
- Re: variable name and its' value are the same characters causes recursion error, Greg Wooledge, 2011/03/10
- Re: variable name and its' value are the same characters causes recursion error, Chet Ramey, 2011/03/10
- Re: variable name and its' value are the same characters causes recursion error, Maarten Billemont, 2011/03/11