title: Why the output of a bash script can be out of order?
body: <p>I'm having an issue with a bash script that produces out of order output.<br>
  This script is used in multiple places and usually works fine.  </p>
  
  <p>In one specific directory however, it goes all out of sync and makes its output file useless.<br>
  The directory structures are identical and the input data it takes are very similar. (Working in ClearCase if that makes a difference.)</p>
  
  <p>When the bash is functional its output looks like this:</p>
  
  <pre><code>Techpack Meta Version is currently 3, has this changed? y/n n
  Have Techpack Version Dependencies changed? y/n n
  Updating Version Properties
  
  Building TPI File
  Inside make_tpi_file
  Created ../package/12.0/M_E_LCHS_DATAGEN_R0E_b1.tpi
  Checked out "package/12.0/" from version "/main/at_job/1".
  Created element "package/12.0/M_E_LCHS_DATAGEN_R0E_b1.tpi" (type "compressed_file").
  Created branch "at_job" from "package/12.0/M_E_LCHS_DATAGEN_R0E_b1.tpi" version "/main/0".
  Checked out "package/12.0/M_E_LCHS_DATAGEN_R0E_b1.tpi" from version "/main/at_job/0".
  Checked in "package/12.0/M_E_LCHS_DATAGEN_R0E_b1.tpi" version "/main/at_job/1".
  Checked in "package/12.0/" version "/main/at_job/2".
  </code></pre>
  
  <p>When the bash is not functional its output looks like this:</p>
  
  <pre><code>Techpack Meta Version is currently 3, has this changed? y/n n
  Have Techpack Version Dependencies changed? y/n n
  Updating Version Properties
  
  Building TPI File
  Inside make_tpi_file
  _R0E_b1.tpipackage/12.0/M_E_HANF_DATAGEN
  Checked out "package/12.0/" from version "/main/at_job/4".
  _R0E_b1.tpi" (type "compressed_file").A_DATAGEN
  _R0E_b1.tpi" version "/main/0".package/12.0/M_E_HANF_DATAGEN
  _R0E_b1.tpi" from version "/main/at_job/0".
  _R0E_b1.tpi" version "/main/at_job/1".GEN
  Checked in "package/12.0/" version "/main/at_job/5".
  
  /vobs/job/job_mg/test_tools/Data_Generator/HANF/FeatureTest/build
  Checked in "install/version.properties" version "/main/at_job/14".
  Checked in "../package/12.2/build.number" version "/main/at_job/4".
  </code></pre>
  
  <p>What could cause a bash script, in general, to produce such a mangled output?<br>
  Considering it works fine for many directories, I don't think the issue is in the code itself, rather in the data read by the script.</p>