procmail
[Top] [All Lists]

Re: trivial procmail question...

2002-10-23 01:18:24
On Tuesday, October 22, 2002, at 01:29 PM, Safran von Twesla wrote:

Hi,

I'm trying to insert a mini-script into a procmail command... it doesn't seem to work... I get a syntax error... My question: do I have to shorten the lines because it's 4 lines long? Or do I have to use a separate script which I only start from procmailrc?

:0 c
| if [ -f "/tmp/reply/$KEYWORD2.html" -eq 0 ] then { (formail -r -A "X-Loop: info(_at_)domain(_dot_)net" -I "From: info(_at_)domain(_dot_)net" -I "MIME-version: 1.0" -I "Content-Type: multipart/mixed; boundary=\"htmlfilexyz\"" ; echo "--htmlfilexyz" ; echo "Content-type: TEXT/PLAIN; charset=ISO-8859-1" ; cat /etc/ftp-mail-text.txt ; echo "" ; echo "--htmlfilexyz" ; echo "Content-Type: TEXT/HTML ; charset=ISO-8859-1; name=\"$KEYWORD2.html\"" ; echo "Content-Transfer-Encoding:8bit" ; echo"" ; cat /tmp/reply/$KEYWORD2.html ; echo "--htmlfilexyz--") | $SENDMAIL -oi -t } else exit 1 fi

It used to work before I inserted the "if then else" part and before $KEYWORD wasn't a variable and was set to the filename.

have you tried breaking the line up?


| if [ -f "/tmp/reply/$KEYWORD2.html" -eq 0 ] then {\
          (formail -r -A "X-Loop: info(_at_)domain(_dot_)net" \
          -I "From: info(_at_)domain(_dot_)net" -I "MIME-version: 1.0" \
          -I "Content-Type: multipart/mixed; boundary=\"htmlfilexyz\"" ;\
echo "--htmlfilexyz" ; echo "Content-type: TEXT/PLAIN; charset=ISO-8859-1" ;\
          cat /etc/ftp-mail-text.txt ; echo "" ; echo "--htmlfilexyz" ;\
echo "Content-Type: TEXT/HTML ; charset=ISO-8859-1; name=\"$KEYWORD2.html\"" ;\ echo "Content-Transfer-Encoding:8bit" ; echo"" ; cat /tmp/reply/$KEYWORD2.html ;\
          echo "--htmlfilexyz--")  | $SENDMAIL -oi -t \
        }\
          else exit 1 \
  fi

More readable at least. Your line does exceed 256 characters. That's often a Bad Thing.



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