title: Bash: assigning to a variable using another variable+text
body: <p>I'm looking to use a for loop to assign several variables using essentially the same code.</p>
  
  <pre><code>#!bin/bash
  for (( i=1; i&lt;=4; i++ )); do
      case ${i} in 
          1) filling=apple; a=an ;; 
          2) filling=peach; a=a ;; 
          3) filling=pecan; a=a ;; 
          4) filling=cherry; a=a ;;
      esac
      echo "Would you like ${a} ${filling} pie? Y/N"
      read var1
      case ${var1} in
         Y|y) ${filling}_pie="True" ;; 
         N|n) ${filling}_pie="No" ;;
      esac
  done
  </code></pre>
  
  <p>This script works exactly as intended except when it comes to assignign the variables at the end. I get <code>apple_pie=True: command not found</code>. I've also tried <code>Y|y) ${${filling}}_pie="True" ;</code>, but when I do that I get <code>bash: ${${filling}}_pie="True": bad substitution</code>.</p>
  
  <p>Either my shell hates pie, or I'm doing something wrong but I can't seem to find an instance of anybody else doing this, or at least I can't an instance of anybody describing it the way I'm trying to describe it when I search on Google...</p>
  
  <p>Is there anyway to get this to assign a variable while using a variable in the assignment?</p>