procmail: No match on ! " $TEST -d "$av_REQUIRED_DIR""
So, the variable $TEST did *not* expand unless the "$" expansion
modifier has been added to the condition, like this:
Robert, your interpretation of the logfile entry is incorrect. The line
in the logfile doesn't mean that the variables aren't expanded: it means
that something other than procmail did the expansion.
When procmail finds a shell metacharacter -- and on a system like yours,
where procmail was compiled with /bin/test nonexistent, procmail
considers the word "test" a shell metacharacter -- and passes the
command line to a shell, procmail lets the shell expand the variables.
The logfile reports the command line passed to the shell, showing the
variables by their names instead of their substituted values. It can
make a difference sometimes: for example, "$$" will be the shell's PID
rather than procmail's, and $- will be (in sh-like shells) the shell's
options rather than $LASTFOLDER. But a variable with an unreserved name
like TEST or av_REQUIRED_DIR will be exported and will have the same
value whether procmail runs the command or hands it to $SHELL.
The reason you still get a failure to match is that the directory does
exist; it's not that the command failed to execute. Didn't you notice
that there's no "program failure" report in the verbose logfile?
Whether procmail is running
/usr/bin/test -d "/home/roal/mail/TRASH/viruses/EXE"
or
$SHELL $SHELLFLAGS '$TEST -d "$av_REQUIRED_DIR"'
the program invoked is happily reporting success back to procmail. Then
procmail calls it "no match" because the exclamation point in front
reverses the outcome. If the command weren't working, your verbose
logfile would have a line like
procmail: Program failure (2) of "$TEST -d "$av_REQUIRED_DIR""
Robert, look, you're trying to write portable code that will work on
systems with /bin/test and systems without /bin/test. Let me make this
suggestion:
Copy or symlink /usr/bin/test to /bin/test;
compile procmail into a different directory from where it is now, but
make sure that it has /usr/bin in its default PATH;
rm /bin/test.
Thereafter, you can try out your code with a version of procmail that
treats "test" as a shell metacharacter and with one that searches $PATH
for a binary named "test".
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail