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?
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" (which at best runs a /bin/test binary, at medium forks a
shell because there was no /bin/test found at compilation, and at worst runs
a /bin/test shell script).
NL="
"
:0
* ^^From .* \/[012][0-9]:..:
* MATCH ?? ^^\/..
{ HOUR=$MATCH }
# If your version of procmail doesn't allow you to re-extract from $MATCH
# later in the same recipe, substitute this:
#
# :0
# * ^^From .* \/[012][0-9]:..:
# { HOURMINUTE=$MATCH }
# :0
# * HOURMINUTE ?? ^^\/..
# { HOUR=$MATCH }
:0
* $ -$HOUR^0
* 13^0
{ # midnight to 12:59:59 PM
LOG=" $HOUR =< 12$NL"
:0:
$PMDIR/before1pm
}
:0E
{ # 1 PM to 11:59:59 PM
LOG=" $HOUR > 12$NL"
:0:
$PMDIR/1pmorlater
}
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
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.