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: Mon, 07 Mar 2011 22:15:49 -0500
User-agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.13) Gecko/20101207 Lightning/1.0b2 Thunderbird/3.1.7

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 expressions to be
evaluated.  You don't have to use the $ to obtain variable evaluation
when using [[ or [.  You get:

[[ a -lt b ]]

which bash treats as expressions to be evaluated, since they're not
numeric.

And so on.

Chet
-- 
``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]