title: Waiting for background processes to finish before exiting script
body: <p>How do I make sure that all my background processes have finished execution before I exit my script (TCL/Bash).</p>
  
  <p>I was thinking of writing all my background process pids to a pidfile. And then at the end pgrep the pidfile to see if any processes are still running before I exit. </p>
  
  <p>Is there some simpler way to do this? And is there a TCL specific way to do this?</p>