[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: test -n STRING and test STRING differ
From: |
Dan Jacobson |
Subject: |
Re: test -n STRING and test STRING differ |
Date: |
Mon, 06 Sep 2004 04:57:04 +0800 |
Paul> I don't see any bug.
Well, you've got to admit that docs like
[-n] STRING
the length of STRING is nonzero
`-n STRING'
`STRING'
True if the length of STRING is nonzero.
and bash's
-n STRING
STRING True if string is not empty.
make it look like we can "make our code clearer by inserting(removing)
-n's", until we discover our test 'find x -mtime +3` does not always
work like test -n `find x -mtime +3`, and no we don't want to use
"`...`".
So we end up in Computer Court and the judge says we lose the case
because we didn't actually give a STRING like you say... however, I
would add a note to the docs, please!
Examining
http://groups.google.com/groups?frame=right&th=73267772355ffa53&seekm=4g9_c.2327$N4.1123%40newsread3.news.pas.earthlink.net
you'll see I used test, so a user misunderstood--yes, his problem. I
was about to change it to test -n to make my ideas clearer, thinking they were
equivalent... but good thing I caught the difference. Please add a warning.