procmail
[Top] [All Lists]

Re: test for existance of external program

2005-04-13 03:34:52
On Wed, Apr 13, 2005 at 12:14:21PM +1200, Volker Kuhlmann wrote:

What's the recommended way for testing whether some external program
$PROG exists?

    :0
    * ? [ -f $PROG ]

Ok ok ok. But it fails with PROG=awk, the other tests in [ are the same
with that. That might leave * $? sh -c "type '$PROG'", is that really
less efficient? (Not that a few microseconds of CPU are worth more than
my time.)

Btw, you don't need the leading $ in your line, and then you'd leave
off the hard quotes around $PROG.  You'd have: * ? sh -c "type $PROG"

As for whether it's worth your time, well, you must have some doubts and
guilty feelings, or you wouldn't be asking in order to waste ours.  ;-)

My answer is, if it were really just a one-off thing and you were never
likely to revisit the issue, and it's about work rather than some
personal thing you're highly proud of, :-) then it might not be worth
the time to futz around and make it perfect.  However -- and this is
what I would claim here -- the "test" stuff on a procmail condition
line is hardly a one-off, and you are a long-term, regular user of
procmail and likely to run into similar issues at some point.  So,
yes, I do think it's worth your time.

Are you giving the right path so the test can find awk?

Dallman

____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail