|
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:1.8.1.24) Thunderbird/2.0.0.24 Mnenhy/0.7.6.666 |
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". Andreas.
But it compares == to 66? Normally, in the shell, if you type in something in double parens it does a mathematical evaluation. i.e. if you are in a while loop lines=0 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!... (ARG....!!.... 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!)... -l
[Prev in Thread] | Current Thread | [Next in Thread] |