如何在bash脚本中使用for循环来卷曲多个url?

时间:2018-02-26 02:19:12

标签: bash curl

我试图为所有7页评论卷曲这个网址,然后将评论存储在一个文本文件中: https://www.amazon.com/Ferrero-Rocher-Hazelnut-Chocolates-Count/product-reviews/B0042TVKZY/ref=cm_cr_getr_d_paging_btm_7?ie=UTF8&filterByStar=three_star&reviewerType=avp_only_reviews&pageNumber=7#reviews-filter-bar

这是我到目前为止所做的:

#!/bin/bash

for i in {1..7}

    do
        URL=$(curl "https://www.amazon.com/Ferrero-Rocher-Hazelnut-Chocolates-Count/product-reviews/B0042TVKZY/ref=cm_cr_getr_d_paging_btm_7?ie=UTF8&filterByStar=three_star&reviewerType=avp_only_reviews&pageNumber=3D${i}#reviews-filter-bar")
        RETURN=$(echo $URL)
        curl $RETURN >reviews${i}.text




    done

0 个答案:

没有答案