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
FROM=|formail -zx From:
The 'c' flag is not needed and should not be used on variable capture
# 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
| 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
| 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
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
SHELL = /bin/sh