title: Wait for bash background jobs in script to be finished
body: <p>To maximize CPU usage (I run things on a Debian Lenny in EC2) I have a simple script to launch jobs in parallel:</p>
  <pre><code>#!/bin/bash
  
  for i in apache-200901*.log; do echo &quot;Processing $i ...&quot;; do_something_important; done &amp;
  for i in apache-200902*.log; do echo &quot;Processing $i ...&quot;; do_something_important; done &amp;
  for i in apache-200903*.log; do echo &quot;Processing $i ...&quot;; do_something_important; done &amp;
  for i in apache-200904*.log; do echo &quot;Processing $i ...&quot;; do_something_important; done &amp;
  ...
  </code></pre>
  <p>I'm quite satisfied with this working solution; however, I couldn't figure out how to write further code to be executed only once ALL of the loops have been completed.</p>
  <p>Is there a way to do this?</p>