如何在shell中curl一个带变量的post请求
有时候,我们想在一个shell中,执行一段脚本,循环post一段json数据,而且body里面的字段名和值都可以是一个变量应该怎么做?
test.sh
id=1111 name="ct" curl http://192.1.13.100:8888/dataservice/knowledge/createKP -H "Accept: application/json" -H "Content-Type: application/json" -d '{"kpId":"'"$id"'","kpName":"'"$name"'","description":"desc","path":"0-1-","sort":1,"version":1,"parentKPId": 1}'
参考链接:http://stackoverflow.com/questions/17029902/using-curl-post-with-variables-defined-in-bash-script-functions
相关推荐
PinkBean 2020-05-04
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
阳光岛主 2020-06-25