Martin recommended,
| lockfile -0 -r0 plainfile
|
| which returns 0 (true) if it could lock the file - hence the file didn't
| already exist - and non-zero if it could not.
I think just -r0 is enough, since it says "don't retry." There's nothing to
wait for if lockfile doesn't retry.
Unfortunately, however, that does the job only if the file exists. If the
file *doesn't* exist, lockfile creates it, and then I need an additional fork
for rm to remove it.
Though I had specified,
... on a system where /bin/test is a shell script ...
Martin's other suggestion was,
| Of course,
|
| test -e plainfile
|
| is also pretty lightweight :-)
Not where /bin/test is a shell script! (Besides, not many versions of test
grok -e; however, for this situation, -f would do.) If /bin/test had been a
binary there, I'd have stuck with test -f (or test -e if it did -e). Then
again, at my other shell account, /bin/test is a binary executable but it's
about eight times the size of /usr/bin/head.
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail