I want to echo some text that has newlines into a file in my bash script. I could just do echo -e "line1 \n line2 \n"
but that would become unreadable when the text becomes very long. I tried doing the following instead with line breaks:
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\
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?