title: List files and show them in a menu with bash
body: <p>I am trying to use the files in a directory as options in a bash script. The user should be able to select one and then pass the name of the selected file into a variable. So far I can get the list of files, but after a few hours trying I can't figure out how to show them as options.</p>
  
  <pre><code>#!/bin/bash
  prompt="Please select a file:"
  options=( $(find -maxdepth 1 -print0 | xargs -0) )
  
  PS3="$prompt "
  select opt in "${options[@]}" "Quit"; do 
  
      case "$REPLY" in
      for i in "${options[@]}"
      do
      $i' ) echo "You picked $opt which is file $REPLY";;'
      done    
      $(( ${#options[@]}+1 )) ) echo "Goodbye!"; break;;
      *) echo "Invalid option. Try another one.";continue;;
  
      esac
  
  done
  </code></pre>
  
  <p>Any help is much appreciated. Thanks!</p>