title: How to split a multi-line string containing the characters "\n" into an array of strings in bash?
body: <p>
  I have a <em>string</em> in the following format:</p>
  
  <pre class="lang-none prettyprint-override"><code>I'm\nNed\nNederlander
  I'm\nLucky\nDay
  I'm\nDusty\nBottoms
  </code></pre>
  
  <p>I would like to move this to an array of strings line by line such that:</p>
  
  <pre class="lang-none prettyprint-override"><code>$ echo "${ARRAY[0]}"
  I'm\nNed\nNederlander
  
  $ echo "${ARRAY[1]}"
  I'm\nLucky\nDay
  
  $ echo "${ARRAY[2]}"
  I'm\nDusty\nBottoms
  </code></pre>
  
  <p>However, I'm running into problems with the "\n" characters within the string itself.  They are represented in the string as two separate characters, the backslash and the 'n', but when I try to do the array split they get interpreted as newlines. Thus typical string splitting with <code>IFS</code> does not work.</p>
  
  <p>For example:</p>
  
  <pre class="lang-none prettyprint-override"><code>$ read -a ARRAY &lt;&lt;&lt; "$STRING"
  $ echo "${#ARRAY[@]}"   # print number of elements
  2
  
  $ echo "${ARRAY[0]}"
  I'mnNednNederla
  
  $ echo "${ARRAY[1]}"
  der
  </code></pre>