At 11:20 2004-03-04 +0100, Robert Allerstorfer wrote:
why so complicated? A one-line condition can first tell you if the ZIP
is encrypted or not:
zipinfo file.zip | sed -ne '2p' | sed -ne 's/^[^ ]* *[^ ]* *[^ ]* *[^ ]*
*\(.\).*/\1/p'
Your "one line" involves a shell, and three program invocations (two of
which could be combined). Talk about complicated.
Why resort to a command pipeline when it can be performed with a SINGLE
program invocation?
ZIPSTATE=`zipinfo file.zip`
:0D
* ZIPSTATE ?? ^^.*$[^ ]* *[^ ]* *[^ ]* *[0-9]+ *\/[TB]
{
# $MATCH contains T or B for FIRST entry only. Note case sensitivity.
}
That's ONE executed program, and the rest of the logic is fully within
procmail. No pipelines, no sed, AND the test has been performed - if
you're in the braced section, it's an encrypted file.
---
Sean B. Straw / Professional Software Engineering
Procmail disclaimer: <http://www.professional.org/procmail/disclaimer.html>
Please DO NOT carbon me on list replies. I'll get my copy from the list.
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail