procmail
[Top] [All Lists]

Re: missing cat data

1999-09-30 10:54:51
On Thu, Sep 30, 1999 at 01:34:27PM -0500, David Stone wrote:
David W. Tamkin suggested:

    MATCH
    :0c # ,,acknowledgement'' is Canadian spelling
    * ! ^FROM_DAEMON
    * $ ! ^X-Loop: $LOGNAME
    * other conditions if any
    * 1^0 ^Subject:\/.*
    * 1^0
    | formail -rkbt -I "Subject: Autoreply${MATCH+ (was $MATCH)}" \
         -A "X-Loop: $LOGNAME" \
         -I "Precedence: junk" \
         -A "X-Comment: Auto-acknowledgement" | \
         sed -e '1,/^$/ !b' -e "/^$/r $PMDIR/autoack.txt" | \
         $SENDMAIL -oi -t


Ugh, that second-last line looks ugly!  What does the /^$/ signify?

^ matches start of line.  $ matches end of line.  ^$ thus matches an
empty line.

Is there some subtle distinction in sed between a script in ' '
and one in " " ?

' means don't do variable expansion, " means do do it.  The '' is used 
around ^$/ to avoid risk that the shell will try to expand out $/,
while the " is used around "$PMDIR/autohack to ensure that the
variable is expanded.

Adam

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