title: var=$((var+1)) in loop doesn't work (only!) when written as a one-liner
body: <p>I have tried several ways to increment in a for loop using a bash command. Each time the $VAR goes through the loop it resets. I have add the ouput of both using let and not using let. I am unsure why not using let doesn work but it doesnt ?</p>
  
  <p>My code works correctly when it's written out like this:</p>
  
  <pre><code>echo "Initial value: $VAR"
  for file in a b c; do
    VAR=$((VAR+1))
    echo "Incremented"
  done
  echo "Final value: $VAR"
  </code></pre>
  
  <p>but it doesn't work like this:</p>
  
  <pre><code>echo "Initial value: $VAR"
  for file in a b c; do VAR=$((VAR+1)) echo "Incremented"; done
  echo "Final value: $VAR"
  </code></pre>
  
  <p>Similarly, it works when I use <code>let</code>:</p>
  
  <pre><code>for file in a b c; do let VAR++; echo "Incremented"; done
  </code></pre>
  
  <p>What's the difference?</p>