title: Append to variable within shell script loop
body: <p>I'm trying to loop over all environment variables in a shell script, and create an HTML query string from ones which match a pattern. Unfortunately, I can't seem to assign to variables in the loop. I've got this:</p>
  
  <pre><code>#!/bin/sh
  IFS=$'\n'
  TAGS=""
  for item in $(printenv)
  do
     if [[ $item == FOO_TAG_* ]]
     then
         TAGS = "${TAGS}&amp;${item}"
     fi
  done
  </code></pre>
  
  <p>But this gives me</p>
  
  <pre><code>/etc/script.sh: line 9: TAGS: command not found
  /etc/script.sh: line 9: TAGS: command not found
  </code></pre>
  
  <p>How do I fix this?</p>