echo -e "From: me\n\n$(tail -n1 /var/log/apache2/error.log)" >> file
-e
option to echo makes it interpret '\n' as a newline$(command)
syntax runs a command, then uses its output in placeThe -e
flag of echo
doesn't work on all systems.
In that case you can use printf
instead.
{ echo some text; echo; tail -n1 /var/log/apache2/error.log; } >> /path/to/file