procmail
[Top] [All Lists]

Re: Re-filtering....

2001-01-09 11:29:28
Philip wrote,

| Of course, if there are shell metacharacters or whitespace in the
| filename, that'll do Bad Things.  If your shell supports arguments to
| commands run via the -c flag, then the following would be safer:
| 
| find $d -maxdepth 1 -type f -exec sh -c 'procmail < "$0"' {} \;

But wouldn't that shell, even if it can take more than one argument after
-c, substitute "procmail" for "$0" rather than the filename that find puts
in for {}?  Shouldn't it be $1 rather than $0, then?

There probably is no good way to use -exec at all.  That brings us back to
not using -exec.  Bennett made the point that

  find $d -maxdepth 1 -type f -print | \
   while read messagefile ; do procmail < $messagefile ; done

can run into trouble if procmail fashions further files find finds 'fore find
finishes finding files.  That's curable in an ugly way with a temporary file:

  find $d -maxdepth 1 -type f -print > messagefilelist
  while read messagefile
   do procmail < $messagefile
  done < messagefilelist
  rm -f messagefilelist

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

<Prev in Thread] Current Thread [Next in Thread>