procmail
[Top] [All Lists]

Re: test for existance of external program

2005-04-14 03:25:01
Volker Kuhlmann:

You do have a SHELL = '/bin/sh' at the start of your .procmailrc?
You did have spaces after the '[' and before the ']'?

See my previous mail. "[ .. ]" is just another name for "test ..".

I know, but since you didn't show how you used the [], I was guessing 
what you might have been doing.


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

That's seriously braindead. 

sh$ type awky && echo OK
awky: not found

Only without path it gives no OK, so be sure there is no path 
inside $PROG when you make use of 'type'.


[...]
In your case, the shell is buggy and returns useless
exit codes for "type".

I am not so sure about that. :)


  SHELL   = '/bin/sh'

  pm_PROG = '/usr/../usr/bin/awk'
#  pm_PROG = 'awk'
#  pm_PROG = 'dances with wolves'
#  pm_PROG = '/a b c'

  pm_TYPE = "`-c \"type '$pm_PROG'\"`"

  :0
  * ! pm_TYPE ?? (): no[a-z ]+$
  {
    :0
    * pm_TYPE  ?? () is \//.*$
    * MATCH    ?? ^^\/.+
    { pm_PROG = "$MATCH" }

    :0
    * pm_PROG ?? /
    *$ ?[ -x '$pm_PROG' ]
    { pm_TYPE = "$pm_PROG is an external executable" }
  }

LOG = "result: $pm_TYPE
"

-- 
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