procmail
[Top] [All Lists]

Re: Problem w/ filter recipe

1997-02-02 15:12:49
Lars Kellogg-Stedman <lars(_at_)software3(_dot_)bu(_dot_)edu> writes:
I have a simple that includes a multi-line sed command.  The command
arguments are enclosed in single quotes, which in sh, and in procmail
variable assignments, will allow it to span multiple lines.  

The filter recipe looks like:

      :0fb
      | $SED '
              /^end[  ]*$/ i\
              ---\
              (File uudecoded into $FILESPEC)\
              ---
              /^begin/,/^end[  ]*$/ d
              ' | \
        $SED "s%\$FILESPEC%$FILEDIR/$FILENAME%g"

And instead of executing as expected, generates a series of "Skipped..."
messages as procmail tries to interpret each line by itself.  I've tried
bracketing the whole thing in '()', but no luck.

To quote the procmailrc(5) manpage:

CAVEATS
     Continued lines in an action line that specifies  a  program
     always  have  to  end in a backslash, even if the underlying
     shell would not need or want the backslash to indicate  con-
     tinuation.   This  is  due  to  the two pass parsing process
     needed (first procmail, then the shell (or not, depending on
     SHELLMETAS)).

The single quotes are therefore insufficient to have procmail recognize the
extent of the action.  Someone else has suggested some alternative sed
recipes that should work, so I suggest just using them.

Philip Guenther

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