title: Bash sum while loop not always giving the same output
body: <p>I have a txt file with integers on each line and i want the sum.          </p>
  
  <pre><code>SUM=0                             
  
  while read line || [ -n "$line" ] ; do
      let "SUM += line"             
  
  done                                  
  echo $SUM                         
  </code></pre>
  
  <p>The problem is that while most of the time I get the correct result, sometimes I get SUM+1.</p>
  
  <p>How can this be explained?</p>
  
  <p>Input file: </p>
  
  <pre><code>2 
  38
  21
  50
  42
  59
  19
  19
  29
  17
  24
  13
  45
  49
  48
  13
  20
  20
  51
  41
  51
  45
  1 
  17
  6 
  46
  52
  50
  32
  19
  8 
  28
  35
  33
  13
  4 
  2 
  49
  32
  19
  17
  17
  16
  51
  23
  32
  26
  54
  31
  54
  14
  17
  55
  53
  18
  34
  4 
  16
  15
  </code></pre>
  
  <p>Expected sum: 1709, sometimes I get 1710.</p>