title: Use GREP on array to find words
body: <p>Given the following array in Shell Programming</p>
  
  <blockquote>
    <p>foo=(spi spid spider spiderman bar lospia)</p>
  </blockquote>
  
  <p>I would like to use GREP to search for all words in the array which has the 3 letters <code>spi</code></p>
  
  <blockquote>
    <p>Correct output : spi spi spider spiderman lospia</p>
  </blockquote>
  
  <p>I have tried something like this </p>
  
  <pre><code>foo=(spi spid spider spiderman)
  
  grep "spi" foo
  </code></pre>
  
  <p>But it seems it is wrong , what is the correct way to go about it ???</p>