title: Arithmetic expression in redirection
body: <p>What is the difference between these two:</p>
  <pre><code>cnt=1
  head -n $((++cnt)) /etc/passwd &gt;/dev/null
  echo $cnt # prints 2
  </code></pre>
  <p>and</p>
  <pre><code>cnt=1
  date &gt;$((++cnt)).txt # creates file &quot;2.txt&quot;
  echo $cnt # prints 1
  </code></pre>
  <p>My question is why in the second example 1 is printed.
  Note:</p>
  <pre><code>cnt=1
  (cnt=5)
  echo $cnt # prints 1
  </code></pre>
  <p>I know why this will print 1. Is the redirection executed in a subshell too? If yes, where is that described?</p>