procmail
[Top] [All Lists]

Re: Recipe setup...

1997-12-02 08:03:29
On Sat, 29 Nov 1997 11:12:53 -0800 (PST), no-mailbox 
<dnhunt(_at_)rain(_dot_)org>
wrote:
On Sat, 29 Nov 1997 11:12:53 -0800 (PST),
no-mailbox <dnhunt(_at_)rain(_dot_)org> wrote:
SUB=`formail -x Subject: | awk '{print $1}' | sed s/:/""/`

Presumably, the intention is to grab the first word after Subject:
which ends in a colon? (The quoting of the sed script is funny, too,
but I suppose you mean to replace the first colon with the empty
string). 

    :0
    * ^Subject:[        ]*\/[^:]+:
    { # You can perhaps omit this^ -- see below
        :0
        * MATCH ?? ^^\/[^:]
        { SUB="$MATCH" }
    }

If you know there will always be a keyword after Subject: which ends
with a colon, you don't need to remove the colon separately if you
instead never grab it in the first place: 

    :0
    * ^Subject:[        ]*\/[^:]+
    { SUB="$MATCH" }

When you use SUB in a regex later on, you should (at least in
principle) use $\SUB instead of $SUB, which will backslash-escape any
regex specials (dot, brackets, question mark, etc). 

On Sat, 29 Nov 1997, Jason Lixfeld wrote:
| mkdir /webhome/server/htdocs/archive/$SUB ; \
chmod 755 /webhome/server/htdocs/archive/$SUB ; \
/usr/local/bin/mhonarc -outdir /webhome/server/htdocs/archive/$SUB \
/home/admin/mail/$SUB ; \
/bin/chmod 644 /webhome/server/htdocs/archive/*/*

This looks a bit screwy, but I don't have mhonarc, so I can't tell if
it couldn't be done more elegantly. I note that you use an explicit
path to chmod in some places, while omitting it in others. If you set
up your PATH carefully, you don't need explicit pathnames for programs
anywhere.

<................ 182 lines of gratuitous quoting elided ................>


/* era */

-- 
 Paparazzi of the Net: No matter what you do to protect your privacy,
  they'll hunt you down and spam you. <http://www.iki.fi/~era/spam/>

<Prev in Thread] Current Thread [Next in Thread>
  • Re: Recipe setup..., era eriksson <=