procmail
[Top] [All Lists]

Re: Problem assigning to and testing a variable

1998-01-06 20:29:27
On Sun, 4 Jan 1998 22:17:15 -0600 (CST),
dattier(_at_)wwa(_dot_)com (David W. Tamkin) writes:

First, my apology for the tardy response to your's and Guy Geens
thoughtful help.  It's been (unexpectedly) two days since I got
mail, and this was most helpful.

Donald Hammond wrote ... well, we all saw his post.

My first comment is that not all versions of date honor the %-escapes,
and that could explain why these assignments:

|    DAY=`date +%a`
|    HOUR=`date +%H`

are failing.  But I'm baffled why the whole rcfile is getting run twice.
What exactly is in the INCLUDERC that is called?

Although your better solution(s) make it a moot point, my version
of date (GNU sh-utils 1.12) does honor the %-escapes.  Whether or
not the ISP's version does is another matter -- and one which has
bit me in the past.

Regarding the rc file being run twice: I goofed.  What I posted
*was* the INCLUDERC.  The $HOME/.procmailrc simply sets up the
environment and INCLUDES this one.  I inadvertently placed the
INCLUDERC statement in this file (including itself again) when
it was created.  When I eliminate that statement, it works
without error.  Sorry.

Regardless, if Donald's incoming mail gets From_ lines, he's better off get-
ting the arrival timestamp from there than by forking a program like date,
and once he gets it he can test its value with procmail's scoring rather than
by using "test" [...]

I honestly thought about procmail's scoring for this, spent some
time with the procmailsc man page, then decided to revert to
something I *thought* I could handle.  I've collected a lot of
scoring examples from this list, and I'm not dense (although I
guess I've yet to prove that here), but I just don't get it ...
yet.

In truth, if he hadn't wanted to log the hour (after all, when one reviews
the logfile, it's there in the From_ line of the logabstract), I'd have
recommended simply this:

  :0:
  * ^^From .* (0.|1[012]):..:
  $PMDIR/before1pm
  :0E:
  $PMDIR/1pmorlater

Well, this is the answer.  The logging was not intended to be
carried over into the implementation.  (No, that wasn't clear
either.)  It was just part of my overly cautious testing (and
curiousity) to make sure that it was working as intended and
not simply by accident.

Finally, Don, are you really sure you want to cut off at 1 PM and not at
noon?  If you work from 9 AM to 5 PM and get most of your mail from others at
your company, then 1 PM is the middle of the workday, so maybe you really do
mean to mark the cutoff at 1 PM.

Nope.  More misleading information.  This was just a random
choice used for testing.  Someday I'll learn to pose the 
questions correctly *and* include the correct information.
It is a testament to your abilities that you can provide the
correct answer(s) to the wrong questions.  ;-)

The following is what I'm going to try.

        :0
        * ^(X-Loop|X-Mailing-List):(_dot_)*procmail(_at_)informatik
        * ^(To|cc):(_dot_)*procmail(_at_)informatik
        {
          { # from Sun 5:00p to Fri 4:59:59p forward a copy to work
            :0 c
            * ^From .*\/ (Sun .* (1[789]|2.):..:|(Mon|Tue|Wed|Thu) \
              |Fri .* (0.|1[0-6]):..:)
            ! DHammond(_at_)fujisec(_dot_)com
          }
        :0:
        $DEFAULT
        }

Again, thanks for the help.

 - Don


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