In the previous episode (29.01.2001), Dave Sill <[EMAIL PROTECTED]>
said:

>>#!/bin/bash
>>#~/filter
>>cat > /tmp/to$RECIPIENT.txt
>>if [ "$(grep 'Subject: whatever' /tmp/to$RECIPIENT.txt)" = "Subject:
whatever" ]
>>then
>>        cat "/tmp/to$RECIPIENT.txt" | qmail-inject devnul
>>else
>>        cat "/tmp/to$RECIPIENT.txt" | qmail-inject $USER-real
>>fi
>>rm -f /tmp/to$RECIPIENT.txt
>>
>>
>>
>>/var/qmail/alias/.qmail-devnul will delete every mail sent to devnul
>
>Why not just not re-inject it?

i wasnt sure if i could use that "if" construction directly in a .qmail
file (can that be done?), and cat was the only thing i could think of to
"keep the data in mind" in order to handle them differently depending on
the result of "if" (i also tried storing the mail in a variable as in
MESSAGE="$(cat)", but that screwed things up ...

>Also, save a fork/exec by doing:
>
>  qmail-inject $USER-real < /tmp/to$RECIPIENT.txt
>
>instead of "cat ... | qmail-inject ...".

yeah, good idea ;)

wolfgang


Reply via email to