title: bash shell script 101 - loop in a script
body: <p>I am trying to create a script that automates one line of command which is used for archiving selected files to tape and creating a text file with the archived files. a and b are inputs and in the example below and I define them as 03 and 15. </p>
  
  <p>a=03</p>
  
  <p>b=15</p>
  
  <p>tar -cvf /dev/tapedrive file_03 file_04 file_05 .........file_15 > /text_files/backup_file_03-15.txt</p>
  
  <p>the script I came up with is below,</p>
  
  <pre><code>#! /bin/bash
  
  a=03
  b=15
  
  for (( c=$a; c&lt;=$b; c++ ))
  $tt=" ";
  do
      if[ ! $c $a ]
      then
          $c="0$c"
      fi
      $tt .= " file_".$c.""
  end    
  
  echo tar -cvf /dev/tapedrive $tt &gt; /text_files/backup_file_$a-$b.txt
  
  done
  </code></pre>
  
  <p>it's 'echo' for now instead of 'do' to make sure I get the right final command line. 
  I am receiving the error </p>
  
  <pre><code>jag5v1.sh: line 9: syntax error near unexpected token `$tt=" "'
  jag5v1.sh: line 9: `$tt=" ";'
  </code></pre>
  
  <p>I would appreciate any input. Thanks!</p>