title: Carriage return \r on bash script
body: <p>I have this bash script on my CentOS 5.3.</p>
  
  <pre>
  #!/bin/bash
  
  RESULT=$(cat /tmp/logfile.log | grep -i "Backlog File Count" | awk '{print $6}')
  
  if [ "${RESULT}" -lt "5" ];
    then
        echo "${RESULT} is less than 5"
    else
        echo "${RESULT} is greater than 5"
  fi
  </pre>
  
  <p><br>
  /tmp/logfile.log:</p>
  
  <pre>
  Backlog File Names (first 1 files)
  </pre>
  
  <p>This bash script should supposedly to get the value "1" on the log file and print the output. However, when I run the script, this is the error message:</p>
  
  <pre>
  : integer expression expected
  </pre>
  
  <p>So when I set the debug mode, I found the "RESULT" variable output:</p>
  
  <pre>
  + RESULT=$'1\r'
  .....
  + '[' $'1\r' -lt 5 ']'
  </pre>
  
  <p>I've noticed that "\r" output is attached on the value.</p>
  
  <p>I would appreciate if any one could lead me why there is "\r" on that output and how to get rid of that error. I tried on CentOS 6.3 and there is no issue.</p>
  
  <pre>
  # rpm -qa bash
  bash-3.2-32.el5_9.1
  </pre>
  
  <p>Thank you.
  James</p>