title: BASH functions inside echo strings
body: <p>I feel like an idiot. I want a BASH function that alternates values every time it's called. The script itself is very simple, and it works if I call the function directly. But it doesn't work the same when called inside a string. Here's the code:</p>
  
  <pre><code>odd_or_even()
  {
      if [ $ODDEVEN -eq 1 ]; then
         echo "odd"
         let "ODDEVEN+=1"
      else
          echo "even"
          let "ODDEVEN-=1"
      fi
  }
  
  ODDEVEN=1
  odd_or_even  # Prints "odd"
  odd_or_even  # Prints "even"
  echo "&lt;td class=\"`odd_or_even`\"&gt;Test&lt;/td&gt;" # Prints class=odd
  echo "&lt;td class=\"`odd_or_even`\"&gt;Test&lt;/td&gt;" # Prints class=odd
  </code></pre>
  
  <p>Does BASH have restrictions about calling functions inside strings? It seems to work because it's outputting something, but it's not performing the mathematical operation.</p>