提问人:PetaBytes 提问时间:1/26/2020 更新时间:1/26/2020 访问量:151
如何不让 Curl 用引号代替空格?[复制]
How to not let Curl replace space with quotes? [duplicate]
问:
我正在编写一个 bash 脚本来启动 curl 请求 我正在读取用户的输入并将其保存为变量
阅读术语
假设用户键入:
“你好世界”
我将变量传递给 curl 请求,如下所示:
curl 'https://someurl.com' -H ... --data '{“term”:'$theterm',....}'
因此,在调试我的数据时,我的数据看起来像:
--data {“term” :“你好','世界”...}
虽然它应该是:
--data {“term” : “你好世界”....}
有什么建议吗?
答: 暂无答案
下一个:显示简单报价之间的变量
评论
--data "{\"term\": \"$theterm\"}"
${theterm//\"/}