title: Define hash tables with arrays as values in bash
body: <p>I know this is almost too complicated for scripting purposes, but bear with me.</p>
  
  <p>I know how you can declare arrays:</p>
  
  <pre><code>arr=(hello world)
  echo ${arr[1]} # "world"
  </code></pre>
  
  <p>And I know that you can use hash maps in bash:</p>
  
  <pre><code>declare -A map=([hello]=world [foo]=bar)
  echo ${map[hello]} # "world"
  </code></pre>
  
  <p>But can you have hash maps that have arrays as values in bash? I've tried several syntaxes, but usually I got a hash map, which had whitespace seperated list of string as the value associated with the hash</p>
  
  <p>EDIT:</p>
  
  <p>An example: I want to write an adapter <code>toolNew</code> for a cmdline tool <code>toolOld</code>. Both just printout some information about the system.</p>
  
  <p><code>toolOld</code> can take nine different arguments <code>a1</code>, <code>a2</code>, <code>a3</code>, <code>b1</code>, ...,  or <code>c3</code>, which I want to simplify.</p>
  
  <p>I.e. <code>toolNew</code> only takes three differen arguments <code>a</code>, <code>b</code>, or <code>c</code>.</p>
  
  <p>The (imo) cleanest way to do this would be to have a function</p>
  
  <pre><code>toolNew() {
      newArgument="$1"
      for argument in "${argumentMap[newArgument][@]}"; do
          toolOld "$argument"
      done
  }
  </code></pre>