Rejo asked,
| I still have one question:
|
| > | formail -tz -xDate: -xFrom: -xSubject: >> $LOGDIR/bot
|
| This puts all the information on new lines. Is there an easy way to have
| to things, Date, From and Subject on a single line?
|
| It is now
|
| Wed, 26 May 1999 23:32:42 +0000
| Rejo <rejo(_at_)sisterray(_dot_)xs4all(_dot_)nl>
| send pgp keys
|
| and i would like to get
|
| Wed, 26 May 1999 23:32:42 +0000 Rejo
<rejo(_at_)sisterray(_dot_)xs4all(_dot_)nl> send pgp keys
|
| in my log. Any idea's?
Several, but if $LOGDIR/bot is not the same as $LOGFILE at that point, that
rules out a few.
Since the >> redirector already forces a shell, this is probably the
simplest:
| echo `formail -z -xDate: -xFrom: -xSubject:` >> $LOGDIR/bot
(formail's -t option makes sense only in conjunction with -r.) I might be
a little reluctant, though, since I'm not positive of parsing order and
somebody could use "send pgp keys; rm -rf $HOME" as the subject. That
*shouldn't* cause a problem (unless you add an extra eval in front), but
I'm not confident.
Better this:
:0 # if $LOGFILE is set and non-null, use LOG variable
$ !${LOGFILE:+!}
{
savelogfile=$LOGFILE
LOGFILE=$LOGDIR/bot
:0
* ^Date: *\/[^ ].*
{ LOG="$MATCH " }
:0
* ^From: *\/[^ ].*
{ LOG="$MATCH " }
:0
* ^Subject: *\/[^ ].*
{ LOG="$MATCH
" }
LOGFILE=$savelogfile
}
:0E # if $LOGFILE is unset or null, don't muck with it
{
:0
* ^Date: *\/[^ ].*
{ LOGDATE="$MATCH " }
:0
* ^From: *\/[^ ].*
{ LOGFROM="$MATCH " }
:0
* ^Subject: *\/[^ ].*
{ LOGSUBJECT="$MATCH" }
:0i
| echo "$LOGDATE$LOGFROM$LOGSUBJECT" >> $LOGDIR/bot
}