title: wait command failing with no errors
body: <p>I have the following script</p>
  <pre><code>command1 2&gt;/dev/null &gt; fileone.txt &amp;
  
  command2 2&gt;/dev/null &gt; filetwo.txt &amp; 
  
  wait
  
  diff fileone.txt filetwo.txt
  
  if [ $? != 0 ]; then
      echo &quot;fail&quot;
  else
      echo &quot;success&quot;
  fi
  </code></pre>
  <p>and when calling it <code>./myscript.sh</code>. the command fails with no error on my console.</p>
  <p>However <code>echo $?</code> returns <code>1</code></p>
  <p>I am assuming it is a timeout issue. Is there a way to validate this? (or to set a timeout explicitly when invoking <code>wait</code>)</p>