How to assign a multiple line value to a bash variable
<p>I have a variable <code>FOO</code> with me that needs to be assigned with a value that will be multiple lines. Something like this,</p>

<pre><code>FOO="This is line 1
     This is line 2
     This is line 3"
</code></pre>

<p>So when I print the value of <code>FOO</code> it should give the following output.</p>

<pre><code>echo $FOO
output:
This is line 1
This is line 2
This is line 3
</code></pre>

<p>Furthermore, the number of lines will be decided dynamically as I will initialize it using a loop.</p>

<p>The answers that have been shown in the other question using mainly <code>read -d</code> is not suitable for me as I am doing intensive string operations and the code format is also important.</p>