title: What is the difference between variable post-increment/decrement and pre-increment/decrement in bash?
body: <p><strong>ARITHMETIC EVALUATION</strong> section in bash manual lists following operators among others:</p>
  
  <pre><code>   id++ id--
            variable post-increment and post-decrement
     ++id --id
            variable pre-increment and pre-decrement
  </code></pre>
  
  <p>As I understand, <code>++x</code> and <code>--xx</code> increase or decrease the variable before other operations are performed? For example <code>x++</code>:</p>
  
  <pre><code>$ x=5; echo $(( ++x / 2 ))
  3
  $ x=5; echo $(( x++ / 2 ))
  2
  $ 
  </code></pre>
  
  <p>However, when are <code>x++</code> and <code>x--</code> useful? And in general what is the difference between variable post-increment/decrement and pre-increment/decrement in bash?</p>