title: Assigning dynamic bash variable names using a for loop seq
body: <p>So I'm trying to do something, not sure if it's possible. I have the following code:</p>
  
  <pre><code>for i in {0..5}; do
      if [[ -f ./user$i ]]; then
          group$i=$(grep -w "group" ./user0|awk '{print $2}'|perl -lape 's/\s+//sg')
  </code></pre>
  
  <p>What I want to do is assign a unique variable for each instance of the {0..5} so group1 group2 group3 group4 for each variable name. Then I would change ./user0 to ./user$i and create a dynamic list of variables based on my sequence.
  Is this possible? I get the following error when trying to execute this and I'm unsure of what I have actually done that bash doesn't like.</p>
  
  <blockquote>
    <p>test.sh: line 16: group0=j: command not found</p>
  </blockquote>