> % test -f /dev/sdC0/plan9       # produces no errors
> % test -f /dev/sdC1/plan9       # produces no errors
>
> As soon as I put a wildcard into the test string, e.g.,
>
> % test -f /dev/sd*/plan9
> test: unexpected operator/operand: /dev/sdC1/plan9
>
>
> Hope this helps - thanks!
>
> Matt

the error message you're getting shows up only when test has been
given an argument it doesn't understand. furthermore, the bad argument
must be the a single character after the first dash (i.e., "test
-[sdkfjsdlfkj" won't trip it, but "test -[ lskdfjlkj" will; notice the
space in the second example). note also that all subsequent arguments
after the second are ignored in the case of -f (test -f /one /two will
happily verify that /one is a file, but not bother about /two)

now, there are not too many chars that test can't interpret, but '/'
is one of them. i'm venturing the possibility that somehow during a
raw input at the console some backspaces escaped into the name of the
first partition, enough so that after it's interpreted by the shell
and then executed it wipes out the "f" in -f. a simple way to trigger:

t.c:

#include <u.h>
#include <libc.h>
void
main() {
        char c = 0x8;
        write(1, &c, 1);
        write(1, &c, 1);
}

b.rc:
#!/bin/rc

var=`{8.out}
echo test -f $var /dev/sdC1/plan9


% b.rc
test - /dev/sdC1/plan9
%

note that for this convoluted case to occur you need to interpret the
backspaces through a console input.

i'm sorry for the noise if this is too far off.

andrey

Reply via email to