Fun w/ test :)

Chris Larson clarson at mvista.com
Mon Jul 21 18:35:07 UTC 2008


clarson at foul busybox% ./busybox test -f =
clarson at foul busybox% ./busybox test \( -f = \)
test: closing paren expected

Hehe.  I highly doubt anyone would actually name a file =, but what the heck, figured you'd
want to know about any cases that confuse the parser.  It's interesting to note that -f =
works, but ( -f = ) does not.  No customer issue on this of course, just made myself try
lots of combinations during the testing.

I found a case where the "unknown operand" error is seen.  If it sees an operand after an
expression, which is not -o or -a, it gives that error:
clarson at foul busybox% ./busybox test -f = -a
clarson at foul busybox% ./busybox test -f = -a -e foo
test: -e: unknown operand

Due to the precedence, that's seen as two expressions without a -a or -o to join them.
The error message could be confusing in this case. -e is, of course, a valid
operator, and -e foo is a valid expression, but -e is not valid -there-, only
-a or -o are.
-- 
Chris Larson
Dedicated Engineer
Montavista, Inc.
Email: clarson AT mvista DOT com
Email: clarson AT kergoth DOT com




More information about the busybox mailing list