title: Define a local array in a bash function and access it outside that function
body: <p>I am trying to define a local array  in a bash function and access it outside that function.</p>
  
  <p>I realise that BASH functions do not return values but I can assign the results of a calculation to  a global value.  I expected this code to echo the content of array[] to the screen. I'm not sure why its failing.</p>
  
  <pre><code>function returnarray
  {
  local array=(foo doo coo)
  #echo "inside ${array[@]}"
  }
  
  
  targetvalue=$(returnarray)
  echo ${targetvalue[@]}
  </code></pre>