#!/bin/bash
data='{"a": "xxxx"}'
a=20
data=`echo $data|
jq 'to_entries |
map(if .key == "a"
then . + {"value":'$a'}
else .
end
) |
from_entries'`
if [ `echo $data | jq '.a'` -eq 20 ];then \
echo 666
fi
data=`echo $data | sed 's/ //g'`
echo $data
curl -X POST \
-H 'Content-type':'application/json' \
-H 'Authorization':'xxxxxxxx' \
-H 'appVersion':'3' \
-d $data http://xxx.xxx.xxx.xxx:9090/api/carselfcheck/
echo
# sudo apt-get install jq -y
# jq: https://www.jianshu.com/p/f50c87b7eaea
# curl: https://www.cnblogs.com/fan-gx/p/12321351.html
shell jd处理json,curl post
最新推荐文章于 2023-12-28 18:00:04 发布