Echo multiline string into file bash
<p>I want to echo some text that has newlines into a file in my bash script. I could just do <code>echo -e "line1 \n line2 \n"</code> but that would become unreadable when the text becomes very long. I tried doing the following instead with line breaks:</p>

<pre><code>echo -e "[general]\
    state_file = /var/lib/awslogs/agent-state\
    [/var/log/messages]\
    file = /var/log/messages\
    log_group_name = /var/log/messages\
    log_stream_name = {ip_address}\
    datetime_format = %b %d %H:%M:%S\
</code></pre>

<p>However, while the text was inserted, no newlines were placed so the whole thing was on one line. Is there anyway to echo text with newlines while also making the bash script readable?</p>