procmail
[Top] [All Lists]

Re: inserting blank line in log file

1996-06-26 10:05:36
Timothy Luoma asked,

| I'm trying to get a blank line in the logfile between [each two entries]:
| 
| :0c
| |/bin/echo " " >> $LOGFILE
| 
| gave errors
| 
|  
| :0c
| |(/bin/echo " " >> $LOGFILE) >/dev/null 2>&1
| 
| gives:
| procmail: Error while writing to "(/bin/echo " " >> $LOGFILE) >/dev/null
| 2>&1"
| 
| I know this must be simple, but I can't figure it.

When you have a recipe with a piping action, procmail expects to feed text
to it.  When the action is something that doesn't read standard input, such
as echo, procmail warns you of a write error.  The `i' flag tells procmail
not to care about such things.  Whenever you have an action that ignores
standard input, you should use the `i' flag (and probably `h' as well to
cut down on the amount of text procmail *tries* to feed to the pipe).

So this will prevent the error message:

 :0chi
 | echo >> $LOGFILE

However, there's an easier way.  Anything assigned to the LOG variable
is appended to the logfile, so to insert a blank line, just do this:

LOG="
"

Note that the closing quotation mark on the second line must not be indented.

You can also get a blank line after each entry with the TRAP facility:

TRAP=echo

or 

TRAP='whatever was already in the TRAP ; echo'

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