title: Bash: how can I use read to echo (or do things to) an array member
body: <p>array content</p>
  
  <pre><code>someCommand=$(cat /etc/somelog) #pseudo 
  </code></pre>
  
  <p>array creation    </p>
  
  <pre><code>array=($someCommand) 
  </code></pre>
  
  <p>array length    </p>
  
  <pre><code>arrayLen=${#array[@]}
  </code></pre>
  
  <p>for loop iterates for array length </p>
  
  <pre><code>for (( i=0; i&lt;${arrayLen}; i++ ));  
  do
  </code></pre>
  
  <p>adds someprefix (for readability )</p>
  
  <p><code>$(($i + 1 ))</code> appends number list (for clear options) starting at 1</p>
  
  <pre><code>echo "$(($i + 1 )) ${arr[$i]/#/someprefix}"    
  
  
  done        
  
  printf "\n"
  echo "Please enter 1-${arrayLen} --&gt; "      
  </code></pre>
  
  <p>asks the user for input</p>
  
  <pre><code> read anwser     
  </code></pre>
  
  <p>stores the value (a case statement woud be better
      # to replace the for loop as well - but this is a concept script) just trying to get it to work.</p>
  
  <h3>this is what I need help with ### (I think?)</h3>
  
  <pre><code>    echo "${array[$anwser]}"   # do things to # 
  </code></pre>