执行批量curl请求脚本注意事项
通过shell生成curl请求 然后批量执行 如下所示
awk -F, 'NR>1{print $(NF-1)}' orders | awk '{print "curl http://localhost:8080/orders?orderSeq="$0"&token=a059a61d7e9211e6a22b4437e6d0648e"}' curl http://localhost:8080/orders?orderSeq=1234567890&token=a059a61d7e9211e6a22b4437e6d0648e awk -F, 'NR>1{print $(NF-1)}' orders | awk '{print "curl http://localhost:8080/orders?orderSeq="$0"&token=a059a61d7e9211e6a22b4437e6d0648e"}' | sh #但是报错 HTTP Status 400 - Required String parameter 'token' is not present # 奇怪 终端上执行单个请求是可以的 curl http://localhost:8080/orders\?orderSeq\=1234567890\&token\=a059a61d7e9211e6a22b4437e6d0648e order 1234567890 not exist
解决方法
给url加上双引号即可
awk -F, 'NR>1{print $(NF-1)}' orders | awk '{print "curl \"http://localhost:8080/orders?orderSeq="$0"&token=a059a61d7e9211e6a22b4437e6d0648e\""}' curl "http://localhost:8080/temp/sendCoupons?orderSeq=1234567890&token=a059a61d7e9211e6a22b4437e6d0648e"
总结
批量执行curl请求 url需要用引号括起来
相关推荐
阳光岛主 2020-06-01
阿债的方寸天地 2020-04-29
83911535 2020-11-13
曾是土木人 2020-10-31
yegen00 2020-10-21
soralaro 2020-10-11
katanaFlower 2020-09-18
wytzsjzly 2020-08-17
88407710 2020-08-17
ChinaJoeEE 2020-08-16
CyborgLin 2020-08-15
Blueberry 2020-08-15
PinkBean 2020-08-11
katanaFlower 2020-08-03
hunningtu 2020-07-30
阿债的方寸天地 2020-06-28
pingyan 2020-06-25
wytzsjzly 2020-06-25