title: How can I store the "find" command results as an array in Bash
body: <p>I am trying to save the result from <code>find</code> as arrays.
  Here is my code:</p>
  
  <pre><code>#!/bin/bash
  
  echo "input : "
  read input
  
  echo "searching file with this pattern '${input}' under present directory"
  array=`find . -name ${input}`
  
  len=${#array[*]}
  echo "found : ${len}"
  
  i=0
  
  while [ $i -lt $len ]
  do
  echo ${array[$i]}
  let i++
  done
  </code></pre>
  
  <p>I get 2 .txt files under current directory.
  So I expect '2' as result of <code>${len}</code>. However, it prints 1.
  The reason is that it takes all result of <code>find</code> as one elements.
  How can I fix this?</p>
  
  <p>P.S<br>
  I found several solutions on StackOverFlow about a similar problem. However, they are a little bit different so I can't apply in my case. I need to store the results in a variable before the loop. Thanks again.</p>