[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 18:50:21 -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 |
Chet Ramey wrote:
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?
The rule you need is in the manual. In a conditional expression parens
only serve to override normal operator precedence. Adding extra pairs
of parens doesn't do anything special.
'if in [[ ]], then you need an extra level of parens around a double-paren
expression to get mathematical evaluation'...
This is pretty much nonsense.
---
Yeah...my 2nd example that worked used ==, not < or >, so sorry
too many days w/o sleep... (again)...it's an on and off again thing depending
on the time of the year....
Since you want to mix conditional and arithmetic comparisons, you might
consider using something like
if [[ -z "" ]] && (( LINES < 80 )); then
foo
fi
----
I needed to compare to numbers for equality, to == worked, but
changed the code around to format them as strings and compared those for
quality amounting to the same thing, except in how they print out)...i.e.
they were 'device numbers, that started in 'hex', (output from stat):
fc02 fc03. At first, I wanted to convert them to integers to compare and
went through all sorts of hell converting 16-bit hex to decimal (\0ffff notation
doesn't work as you know (and I "re-found out -- *oh yeah!*)...bash is still
an 8-bit shell! ;-))... so broke the nibbles apart and coverted them, and
realized
I didn't want a 16-bit decimal anyway, but "(maj:min)" format... just took me
a few
hours to get to that point.
Part of my problem is I keep going back and forth from perl to bash, and
keep sometimes have a habit of mentally bringing in habits from one lang to the
other.
More than once have wished for more 'perl' in my bash...