#!/bin/bash if [ $# -lt 2 ]; then echo 'Usage:' echo '1. run 1 allowed_domain' echo 'crawl all imgs in the allowed_domain' echo '2. run 2 input_file' echo 'crawl the imgs and attach the corresponding tags in input_file' exit 0 fi cd crawler/crawler input_file=input.txt if [ $1 = 1 ]; then echo $1 > ${input_file} echo $2 >> ${input_file} scrapy crawl img elif [ $1 = 2 ]; then echo $1 > ${input_file} echo $2 >> ${input_file} scrapy crawl img else echo 'Invalid mode!' fi