I am doing the following:
x="Hello to the world of tomorrow\n <pre>";
x="${x}$(tail -n 50 log/logfile.log)"
x="${x}</pre>";
echo -e $x | ./perlscript
The Perl script:
#!perl
# perlscript
open(MAIL, "sendmail -t")
print MAIL "EMAIL HEADERS\n\n"
print MAIL <STDIN>
close(MAIL);
When I receive the email, the log file doesn't have any \n inside the <pre> tag. The Hello to the world of tomorrow works fine and the \n is represented.
How to I get tail not to remove any \n, or is it something further down/up the chain?
\n(2 characters) or a newline character? Keep in mindechois very nonportable when it comes to handling backslashes. If you want predictable behavior useprintfinstead ofecho. – jw013 Sep 26 '12 at 14:50\n, and its a bashscript, but could be command line – whoami Sep 26 '12 at 14:51echoshould beecho -e– whoami Sep 26 '12 at 14:56echo -e \nprobably means you really want an actual newline, andecho -e \nis your attempt at getting one. – jw013 Sep 26 '12 at 15:19print MAIL "EMAIL HEADERS\n\n"was an abbreviation for HTML content type header, and all the to: from: subject: fields. Sorry was lazy to type :D – whoami Sep 26 '12 at 15:50