procmail
[Top] [All Lists]

Re: test for existance of external program

2005-04-13 04:37:46
Dallman Ross:
Volker Kuhlmann:

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

Try  PROG = '/usr/bin/awk'


, the other tests in [ are the
same with that. That might leave * $? sh -c "type '$PROG'"

You do have a SHELL = '/bin/sh' at the start of your .procmailrc?

You did have spaces after the '[' and before the ']'?

The type-test doesn't work here:

sh$ type /usr/bin/awk && echo OK
/usr/bin/awk is /usr/bin/awk
OK

sh$ type /usr/bin/awky && echo OK
/usr/bin/awky: No such file or directory
OK


The [] test does work:

sh$ [ -x /usr/bin/awk ] && echo OK
OK

sh$ [ -x /usr/bin/awky ] && echo OK

All the above is directed to Volker. :)


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"

Maybe they were there for when PROG has embedded whitespace.

-- 
Grtz, Ruud

____________________________________________________________
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