title: for loop linux scripting: Syntax error: Bad for loop variable
body: <p>I'm at the very beginning in scripting. ( I have just finished Linux LPI essentials)
  I have the following challenge:</p>
  
  <p>Create a new group. Each group must have a unique name. The script must check to ensure that no duplicate group names exist on the system. If a duplicate is found, an error needs to be reported, and the administrator must try another group name.</p>
  
  <p>Here is my "script":</p>
  
  <pre><code>#!/bin/bash                                                                     
  
  echo "Please enter a group name"                                                
  read gname                                                                      
  
  for $gname in /etc/group; do                                                    
  echo "Please enter another group name"                                          
  read gname                                                                      
  done                                                                            
  
  groupadd $gname                                                                 
  echo "Group $gname has been created" 
  </code></pre>
  
  <p>this is the error I received.</p>
  
  <pre><code>Please enter a group name                                                       
  alexandru                                                                       
  test.sh: 6: test.sh: Syntax error: Bad for loop variable 
  </code></pre>