title: Set variables in parallel in bash
body: <p>Here's an example program:</p>
  
  <pre><code>#!/bin/bash
  
  for x in {1..5}
  do
    output[$x]=$(echo $x) &amp;
  done
  
  wait
  
  for x in {1..5}
  do
    echo ${output[$x]}
  done
  </code></pre>
  
  <p>I would expect this to run and print out the values assigned to each member of the <code>output</code> array, but it prints nothing. Removing the <code>&amp;</code> correctly assigns the variables. Must I use different syntax to achieve this in parallel?</p>