title: Read a file into variable preserving spaces and newlines
body: <p>As the question implies I am intending to store the input through a bash script in raw format using a single variable.</p>
  <p>Basically when the input prompt occurs, I would be pasting some bunch of lines and then writing that stored variable to a text file. After a bit of search I did came across readarray but it is not storing the input/paste in its original paste state</p>
  <p>Just for the purpose of simplicity lets say the input/paste I am intending to store in the variable is as follows:</p>
  <pre><code>1
   2
    3
     4
      5
  </code></pre>
  <p>Expected script</p>
  <pre><code>#!/bin/bash
  #the part i need help with ( Store the multiple line input/paste in raw format in a variable called let say test ) 
  ....
  echo &quot;$test&quot; &gt; test.txt
  cat test.txt
  </code></pre>
  <p>This should print that 1..5 exactly in the format I have pasted during input prompt in console / also shown above</p>
  <p>Edit - It might be possible someone is curious what is my actual use case, so I am giving an example what my paste actually is in real use case. I used 1..5 example in question only for simplicity.</p>
  <pre><code>https://cdn.jwplayer.com/videos/XXXizsW4-32313922.mp4
    out=Lecture 01- AS 1 Theory.mp4
  https://cdn.jwplayer.com/videos/XXX6XFPB-32313922.mp4
    out=Lecture 02- AS 1 Question.mp4
  https://cdn.jwplayer.com/videos/XXXIeQNM-32313922.mp4
    out=Lecture 03- AS 2 Theory.mp4
  </code></pre>
  <p>I would be pasting text in such format only</p>
  <pre><code>https://link
    out=Some-Name.mp4 ( 2 spaces before word out )
  </code></pre>
  <p>Although there are 300,400 such pairs of lines that I would be pasting (if that matters).</p>