我需要一个在循环中执行curl请求的脚本。必须替换请求的一个参数
PARAM[0]=FOO
PARAM[1]=BAR
for i in "${PARAM[@]}"
do
:
echo $i
curl 'http://testurl.com/test' -H 'Accept: text/plain, */*; q=0.01' -H 'Accept-Encoding: gzip, deflate' -H 'Accept-Language: de,en-US;q=0.7,en;q=0.3' -H 'Cache-Control: no-cache' -H 'Connection: keep-alive' -H 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8' -H 'Host: ipq-t2.bmwgroup.net' -H 'Pragma: no-cache' -H 'Referer: http://testurl.com/test' -H 'X-Requested-With: XMLHttpRequest' --data 'param=$i' --compressed >> response.txt
done
问题出在curl命令中,$ i显然没有被循环中数组中的数据正确替换。
感谢任何帮助。谢谢!