title: bash changes execution order of command when run from jenkins
body: <p>I am using git log to update a release_notes for my project.  When I run the script below on my mac laptop everything works as expected, when I run on jenkins running on centos I see the following as the execution order:</p>
  
  <p>script</p>
  
  <pre><code>...
  FILE=RELEASE_NOTES
  TMP_FILE=${FILE}.tmp
  VERSION=$(cat pom.xml | grep "&lt;version&gt;" | head -n1 | sed -e "s/.*\&gt;\(.*\)\&lt;.*/\1/" | tr -d "\-SNAPSHOT")
  NAME=$(cat pom.xml | grep "&lt;artifactId&gt;" | head -n1 | sed -e "s/.*\&gt;\(.*\)\&lt;.*/\1/")
  
  echo "$NAME-${VERSION}" &gt; ${TMP_FILE}
  git log --pretty="%x09* [%h] %s." $(git describe --abbrev=0)..HEAD &gt;&gt; ${TMP_FILE}
  
  echo "" &gt;&gt; ${TMP_FILE}
  
  if [ -e $FILE ]; then
    cat ${FILE} &gt;&gt; ${TMP_FILE}
  fi
  
  mv ${TMP_FILE} $FILE
  ...
  </code></pre>
  
  <p>jenkins output when run with #!/bin/bash -x</p>
  
  <pre><code>+ FILE=RELEASE_NOTES
  + TMP_FILE=RELEASE_NOTES.tmp
  ++ tr -d '\-SNAPSHOT'
  ++ head -n1
  ++ cat pom.xml
  ++ sed -e 's/.*\&gt;\(.*\)\&lt;.*/\1/'
  ++ grep '&lt;version&gt;'
  + VERSION='&lt;/'
  ++ head -n1
  ++ sed -e 's/.*\&gt;\(.*\)\&lt;.*/\1/'
  ++ cat pom.xml
  ++ grep '&lt;artifactId&gt;'
  + NAME='&lt;/'
  + echo '&lt;/-&lt;/'
  ++ git describe --abbrev=0
  </code></pre>
  
  <p>I cant figure out why the execution order is changing.  Any thoughts?  </p>