procmail
[Top] [All Lists]

Re: multiple 'test -x '

1997-06-06 11:39:00
"Timothy J. Luoma" <luomat(_at_)peak(_dot_)org> writes:
when the do the following, I get:

"test: too many arguments"

It works in /bin/sh just fine....

I'm just trying to do a simple test to make sure that all 3 crucial commands  
are executable

here's the recipe:


## begin

SHELL=/bin/sh
...
:0
* ! ? test -x $APPNMAIL -o -x $FORMAIL -o -x $GREP
{
...
}

The test command is not always the same as the one builtin to the shell.
In particular, a POSIX compliant test command will not accept the above
(POSIX's test doesn't have -a or -o flags).  You can either force the
use of the shell by putting a semicolon at the end of the line, or you
can use the shell's || and && operators to do the logic (see below).
I'll note that your logic is reversed: you should be and'ing, not or'ing.

        :0
        * ! ? test -x $APPNMAIL -a -x $FORMAIL -a -x $GREP ;
        {
            ...
        }
or
        :0
        * ! ? test -x $APPNMAIL && test -x $FORMAIL && test -x $GREP
        {
            ...
        }


Philip Guenther

<Prev in Thread] Current Thread [Next in Thread>