Daniel <daniel(_at_)adinet(_dot_)com(_dot_)uy> writes:
I hope any of you can give me a hand with this recipe, I want to append a
variable to a file.
I have isolated the part of it, which doesn't work
# First I extract the variable, for example FROM
:0 c
FROM=|formail -zx From:
The 'c' flag is not needed and should not be used on variable capture
recipes.
# Now, as a suggestion from Era (Thank you), I want to write it to a file
named "lista", but it doesn't work
# Note I tested creating an empty file also
:0 c
| formail -XFrom: >>$HOME/public_html/webmaster/lista
That should work, though you should add a colon to the end of the ":0 c"
line so that procmail will lock the file being appended to.
# Then, I tried another suggestion which didn't work either
:0 c
| echo $FROM >> $HOME/public_html/webmaster/lista ;\
date +"%B %e %r" >> $HOME/public_html/webmaster/lista ;\
echo $NL >> $HOME/public_html/webmaster/lista
This could also use some locking.
# This lines below, are just to check if the path and extraction of the
variable were correct, and it works #fine, I obtain the message written on a
file named the variable FROM
:0 c
$HOME/public_html/webmaster/$FROM
The fact this works and the previous ones don't is an almost sure sign
that SHELL is misset. Add the following to the _top_ of your
.procmailrc:
SHELL = /bin/sh
Philip Guenther