title: BASH: Send output of complex command to an array
body: <p>NOTE FROM OP:  Oops.  My mistake.  I happened to let grep hunt for something(s) non-existent.  Of course I got no output.  And yes, this is a dup of <a href="https://stackoverflow.com/questions/1753366/redirect-output-to-a-bash-array">another question</a>.</p>
  
  <p>&lt;>&lt;>&lt;>&lt;>&lt;>&lt;>&lt;>&lt;>&lt;>&lt;>&lt;>&lt;>&lt;>&lt;>&lt;>&lt;>&lt;>&lt;>&lt;>&lt;></p>
  
  <p>There are many answers on the web to (most of) this question.  The "most of" part is my problem.</p>
  
  <p>How do I capture the output of a command line into a bash array when the command line contains pipe chars, "|"?</p>
  
  <pre><code> array=($(ps -ef | grep myproc | grep -v grep))
  </code></pre>
  
  <p>doesn't work.  Neither does:</p>
  
  <pre><code> array=(`ps -ef | grep myproc | grep -v grep`)
  </code></pre>
  
  <p>(those are backquotes in case your font mangles them).</p>
  
  <p>And, can the given answer be use with <strong>array+=</strong> syntax?</p>