title: running bash script in cygwin on windows 7
body: <p>I am trying to run the below bash script in cygwin on windows 7</p>
  
  <pre><code>REPEATTIMES="$1"
  
  if [ $# = 0 ]; then
  
      echo "Usage: fetch topN repeatTimes"
      exit 1
  fi
  
  for (( i=1; i&lt;=$REPEATTIMES; i++ ))
  do
      echo "ITERATION: $i"
      echo "GENERATING"
  
      log=thelogs/log 
  
      bin/nutch generate crawl/segment -topN 10 &gt; $log
      batchId=`sed -n 's|.*batch id: \(.*\)|\1|p' &lt; $log`
  
      echo "batch id: $batchId "
  
      # rename log file by appending the batch id
      log2=$log$batchId
      mv $log $log2
      log=$log2
  
      echo "FETCHING"
      bin/nutch fetch crawl/segments/$batchId &gt;&gt; $log
  
      echo "PARSING"
      bin/nutch parse crawl/segments/$batchId &gt;&gt; $log
  
  
      echo "UPDATING DB"
      bin/nutch updatedb crawl/crawldb crawl/segments/$batchId &gt;&gt; $log
  
      echo "Done "
  
  done
  </code></pre>
  
  <hr>
  
  <p>But when i run it i get the error :</p>
  
  <pre><code>line 11 :syntax error near unexpected token '$'\r'
  
  line 11 :'for (( i=1; i&lt;= REPEATTIMES; i++ ))
  </code></pre>
  
  <p>The script works fine on a ubuntu server. But i need to run it now on a windows machine.</p>