title: Create bash select menu with array argument
body: <p>I have a function called <code>createmenu</code>. This function will take in an array as the first argument. The second argument will be the size of the array.</p>
  
  <p>I then want to create a select menu using the elements of that array. This is what I have so far:</p>
  
  <h1>Create the menu with the given array</h1>
  
  <pre><code>createmenu ()
  {
    echo $1
    echo "Size of array: $2"
    select option in $1; do
      if [ $REPLY -eq $2 ];
      then
        echo "Exiting..."
        break;
      elif [1 -le $REPLY ] &amp;&amp; [$REPLY -le $2-1 ];
      then
        echo "You selected $option which is option $REPLY"
        break;
      else
        echo "Incorrect Input: Select a number 1-$2"
      fi
    done
  }
  </code></pre>
  
  <p>This is an example call to the function:</p>
  
  <pre><code>createmenu ${buckets[*]} ${#buckets[@]}
  </code></pre>
  
  <p>How do I create this select menu using the elements of the argument array as options?</p>