procmail
[Top] [All Lists]

"$" modifier on "?" conditions

2004-03-11 02:28:22
On Mon, 08 Mar 2004, 07:49 GMT-06 David W. Tamkin wrote:

* $ ! ?"$TEST -d $VIRUSDIR/EXE"

did it:

procmail: Executing
"/usr/bin/test,-d,/home/roal/mail/TRASH/viruses/EXE"

By the way, you don't need the "$" modifier on "?" conditions unless you
want to simulate an eval and have two evaluation passes on the line.

I guess you have not tested that suggestion because it's simply wrong.
My originally posted code

* $ ! ?"$TEST -d $VIRUSDIR/EXE"

(as cited above) works well - it results in the following verbose log:

procmail: Executing "/usr/bin/test,-d,/home/roal/mail/TRASH/viruses/EXE"
procmail: No match on ! "/usr/bin/test -d /home/roal/mail/TRASH/viruses/EXE"


After I removed the "$" modifier from the condition, following your
suggestion, so the code changed to

* ! ?"$TEST -d $VIRUSDIR/EXE"

the log gives the following errors:

procmail: Executing "/usr/bin/test -d /home/roal/mail/TRASH/viruses/EXE"
/usr/bin/test -d /home/roal/mail/TRASH/viruses/EXE: /usr/bin/test -d 
/home/roal/mail/TRASH/viruses/EXE: No such file or directory
procmail: Non-zero exitcode (1) from "/usr/bin/test -d 
/home/roal/mail/TRASH/viruses/EXE"
procmail: Match on ! "/usr/bin/test -d /home/roal/mail/TRASH/viruses/EXE"


Note that removing the "$" modifier did expand the $ variable names
successfully as before ($TEST has been expanded to '/usr/bin/test' and
$VIRUSDIR to '/home/roal/mail/TRASH/viruses'), *but* - as you can see
- procmail did not execute the entire command directly as it did
before. And, much more bad, the command has not even been executed
properly (although the log entry may assume this) - '/usr/bin/test'
could even not be found anymore.

So, I would never ever think of removing the "$" modifier from such
"?" conditions anymore :-)

best regards,
rob.



_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail