title: Bash script that creates an Array from ls?
body: <p>I am in the process of creating a bash script that will list the files (in this case apache sites-available). Listing the files is easy by my ultimate goal would be to take each of those files into an array, display them to the user and allow the user to select which "file" to process, in this case it would be to enable the site.</p>
  
  <p>I haven't gotten very far, I know I need to set the ls as an array and then loop the action: </p>
  
  <pre><code>array=$(ls)
  for sites in $array(2)
  do
  echo "$sites"
  done
  </code></pre>
  
  <p>I know that I need to index each of the files in the directory and then allow the user to type the number to enable. So it would look like this:</p>
  
  <pre><code>(1) newdomain.com
  (2) newdomain2.com
  
  Which site would you like to enable (i.e 1)?
  </code></pre>
  
  <p>Hopefully that makes sense?</p>