Dallman Ross <dman(_at_)nomotek(_dot_)com> writes:
Bennett Todd <bet(_at_)rahul(_dot_)net> wrote:
find renamed-maildir/{new,cur} -maxdepth 1 -type f | \
while read f;do procmail <$f; done
What's the advantage of this over, say,
d=renamed-maildir/{new,cur}
find $d -maxdepth 1 -type f -exec procmail < {} \;
The command given to find's -exec argument is _not_ run through a
shell, so the < is not treated as a file redirection.
Actually, because you didn't escape it, it'll be interpreted before
find is invoked. What you wrote is the same as:
find $d -maxdepth 1 -type f -exec procmail \; < {}
That'll generate an error unless you have a file named "{}" lying
around and isn't at all what you wanted.
So, you'll need a shell. Some versions of find with expand embedded
occurances of {} to the target path, in which this will work:
find $d -maxdepth 1 -type f -exec "procmail < {}" \;
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"' {} \;
Philip Guenther
Procmail Maintainer
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail