« Return to Thread: Shell script - insert newline into string

Re: Shell script - insert newline into string

by Tony Wilson-4 :: Rate this Message:

Reply to Author | View in Thread

Thanks for your help everyone!

The problem was that I was doing:

echo ${string}

and I should have done:

echo "${string}"

So, in my actual script:

     message=`echo -e "${subject}\n${from}\n${to}\n\n${content}"`
     
    echo "$message" | msmtp ${to}


Cheers
Tony

 « Return to Thread: Shell script - insert newline into string