title: Is there a way to know the key of an array after indirect expansion?
body: <p>For example:</p>
  <pre><code>#! /usr/bin/bash -
      
  declare -A fruit_colour
  fruit_colour[&quot;apple&quot;]=&quot;red&quot;
  fruit_colour[&quot;banana&quot;]=&quot;yellow&quot;
  fruit_colour[&quot;durian&quot;]=&quot;green&quot;
      
  declare -A thing_colour
  thing_colour[&quot;keyboard&quot;]=&quot;black&quot;
  thing_colour[&quot;shirt&quot;]=&quot;red&quot;
  thing_colour[&quot;desk&quot;]=&quot;white&quot;
      
  target=&quot;thing&quot;    #or &quot;fruit&quot;
  output=&quot;${target}_colour[@]&quot;
      
  for item in ${!output}; do
      echo $item
  done
  </code></pre>
  <pre><code>output:
  white
  red
  black
  </code></pre>
  <p>I have some arrays with different prefixes, and I want to access the array according to the target. But I would also like to know the corresponding key (desk, shirt, keyboard) to the value and I wonder if there is a way to retrieve them.</p>