On 10 Mar 2011, at 15:23, Chet Ramey wrote:
>
> 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 ]];
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 exce
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
On Thu, Mar 10, 2011 at 5:14 AM, Peggy Russell
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
On Thu, Mar 10, 2011 at 5:14 AM, Peggy Russell
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
> 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 d
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? Failur
>
> 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.
--
``The lyf so short, the craft so
> 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 var
On 3/7/11 11:48 PM, Peggy Russell wrote:
> It would be helpful if indirection was explained in the documentation for
> [[ expression ]], [ expression ], and declare.
The existing documentation seems pretty clear:
Shell variables are allowed as operands; parameter expansion is per-
formed befor
> Since those are not numeric, bash treats them as expressions to be
> evaluated. You don't have to use the $ to obtain variable evaluation
> when using [[ or [. You get:
c=1;a="c";b=2;[[ a -lt b ]]; echo $?
0
c=3;a="c";b=2;[[ a -lt b ]]; echo $?
1
I see. I was aware of explicit indirection as
On 3/6/11 3:13 PM, Peggy Russell wrote:
> Hi Chet,
>
> Summary
> ***
> When a variable name and its' value are the same characters (a="a"),
> a recursion error occurs.
Quite true.
If you expand the problem expression, you get
[[ a -lt b ]]
Since those are not numeric, bash treats them as e
12 matches
Mail list logo