procmail
[Top] [All Lists]

Re: Odd behavior or incorrect recipe?

2002-04-18 20:32:05
On Thu, 18 Apr 2002, Mike Loiterman wrote:

Message-ID: <t2mads2w018(_dot_)fsf(_at_)objenv(_dot_)com>
X-Spam-Status: No, hits=-4.2 required=5.0 

I'm using the following procmail recipe which I would like to pull
out the number of hits in X-Spam-Status and the Message-ID:

SPAM_STATUS=`grep X-Spam-Status |cut -d' ' -f3|cut -d'=' -f2 |sort
- -n` MESSAGE_ID=`formail -xMessage-ID:: \
| sed -e 's/[;\`\\]/ /g' \
| expand | sed -e 's/^[ ]*//g' -e 's/[ ]*$//g'`

Egad.  Seven processes where you could get by with zero?  What in the
world is that "sort" supposed to accomplish?

:0: $HOME/email-scores.$LOCKEXT
* ^X-Spam-Status:.*hits=\/[-0-9.]+
{
 SPAM_STATUS=$MATCH
 :0
 * ^Message-Id: *\/.*
 { MESSAGE_ID="$MATCH" }

  DATE=`date +"%m/%d/%y %H:%M"`
  nada=`echo "$DATE $SPAM_STATUS $MESSAGE_ID" >> $HOME/email-scores`
}

The output looks like this:
04/18/02 21:14 <t2mads2w018.fsf>

Any idea why?

My guess is that it has something to do with the < and > characters in the 
$MESSAGE_ID string being treated as redirections by the shell when the 
echo is executed.  Hence the additional double quotes in the nada= above.

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