title: How to use an array with remote variable on remote server in shell scripting?
body: <p>This is what I am trying to do...</p>
  
  <pre><code>#!/bin/bash
  
  array_local=(1 2 3 4 5)
  
  ssh user@server &lt;&lt; EOF
  index_remote=1
  echo \$index_remote
  echo \${array_local[\$index_remote]}  
  EOF
  </code></pre>
  
  <p>When I try to run the above script I get the O/P as 1 and a null value (blank space). I wanted ${array_local[$index_remote} value to be 2 instead of null, I need to access this local array using remote variable for my further work in the script..</p>