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