title: How to convert command output to an array line by line in bash?
body: <p>I'm trying to convert the output of a command like <code>echo -e "a b\nc\nd e"</code> to an array.</p>
  
  <pre><code>X=( $(echo -e "a b\nc\nd e") )
  </code></pre>
  
  <p>Splits the input for every new line and whitespace character:</p>
  
  <pre><code>$ echo ${#X[@]}
  &gt; 5
  
  for i in ${X[@]} ; do echo $i ; done
  a
  b
  c
  d
  e
  </code></pre>
  
  <p>The result should be:</p>
  
  <pre><code>for i in ${X[@]} ; do echo $i ; done
  a b
  c
  d e
  </code></pre>