title: Bash: Increment a counter variable within a string
body: <p>In Bash, I'm trying to increment a counter variable (number) from within a text string. If I call the counter var alone it increments successfully, but If I echo the string variable on each iteration of my loop, the counter variable does not increment.</p>
  
  <pre><code>#!/bin/bash
  
  number=1
  
  yes="number$number/"
  
  for i in 1 2 3
  do
      echo $number
  
      echo $yes
  
      ((number++))
  
  done
  </code></pre>
  
  <p>I get this output:</p>
  
  <pre><code>1
  number1/
  2
  number1/
  3
  number1/
  </code></pre>
  
  <p>Whereas I expect this:</p>
  
  <pre><code>1
  number1/
  2
  number2/
  3
  number3/
  </code></pre>
  
  <p>I have also tried this:</p>
  
  <pre><code>yes="number${number}/"
  </code></pre>
  
  <p>..which gave the same incorrect result.</p>
  
  <p>Thanks</p>