just another one of my rumblings
Paul Smith
paul at mad-scientist.us
Mon Apr 28 14:52:50 UTC 2008
On Mon, 2008-04-28 at 10:22 -0400, Paul Fox wrote:
> > Completely agree! "-n" clearly means a non-empty string. Without the "-n" or
> > "-z", are we interested in the variable's string or numerical vaue?
>
> the string. that's how it's defined, and always has been.
Not that it matters, but I've been shell scripting since the 1980's and
I STILL have to go look up -n and -z half the time to make sure I've got
them correct. That info must live in a soft part of my brain (not that
there are many other parts these days).
Personally I don't find the mnemonics for -n and -z obvious AT ALL. I
think BOTH of them look like they mean "empty": -n for "nothing" and -z
for "zero" (length). Saying "-n" means "non-empty" is some bizarre
double-negative thing which I can't grok. My "clean-o-meter" barfs it
up.
But, I don't care about this personally: I'm just pointing out that -n
and -z are not more obvious to everyone, even people who know a lot
about scripting. I often use case statements to compare variables since
it's faster when "[" and test are not shell built-ins.
P.P.S. Bikesheds must be brown. Obviously.
More information about the busybox
mailing list