title: Bash script says command not found
body: <p>I try to run the following bash script to create a bunch of users, groups, home dirs for the users and correct permissions for all of these. The OS is CentOS.</p>
  
  <p>When I try to run the following, which I though should work, it returns "command not found" when running via terminal. it only gets as far as creating the /homedirs directory, nothing more. I'm a total noob at bash scripting so forgive me if this looks ugly.</p>
  
  <pre><code>mkdir /homedirs; chmod 775 /homedirs;
  
  for iYear in {1..3} do
      sYear = $iYear"ti"
      sYearDir = "/homerirs/"$sYear
      groupadd $sYear; mkdir $sYearDir; chgrp $sYear $sYearDir; chmod 750 $sYearDir
  
      for sClass in {a,b} do
          sClassDir = $sYearDir/$sClass
          mkdir $sClassDir
          sClassGrp = $sYear$sClass
          groupadd $sClassGrp; chgrp $sClassGrp $sClassDir; chmod 750 $sClassDir
  
          for iUser in {1..3} do
              sUserName = "i"$iYear$sClass"g"$iUser
              sUserDir = $sClassDir/$sUserName
              useradd -d $sUserDir -g $sClassGrp -G $sYear -m $sUserName
              chown $sUserName $sUserDir; chmod 750 $sUserDir
          done
      done
  done
  </code></pre>