[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bug, or am I confused?

From: Linda Walsh
Subject: Re: Bug, or am I confused?
Date: Sun, 10 Jul 2011 15:33:41 -0700
User-agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv: Thunderbird/ Mnenhy/

Andreas Schwab wrote:

Linda Walsh <address@hidden> writes:

 if [[ -z "" && ((LINES < 80 )) ]]; then echo foo; fi
(prints nothing)....

What am I missing?

"LINES" does not sort before "80".


But it compares == to 66?

Normally, in the shell, if you type in something in double parens
it does a mathematical evaluation.

if you are in a while loop

while read foobar; {
   ((++lines))  #increments value of lines by 1
   ((lines>23)) && break;  #and quits if more than 23 lines are read

so I'd expect the above to eval my shell-var, 'lines'...
Ah....I see....I need another set of parens!...
What rule should I have remembered to 'know' that?

'if in [[ ]], then you need an extra level of parens around a double-paren
expression to get mathematical evaluation'...

(seems like a pretty specific rule (i.e. does it generalize from something?))

I guess many of us are still learning about these things as they unfold --
and of course Chet keeps ahead of us by continually throwing in more benefits...
(if we can decipher them!)...


reply via email to

[Prev in Thread] Current Thread [Next in Thread]