相关文章推荐
傻傻的大脸猫  ·  PG SQL 问题:Character ...·  1 月前    · 
侠义非凡的大象  ·  about_Special_Characte ...·  1 周前    · 
近视的冲锋衣  ·  java - ...·  1 年前    · 
睿智的羊肉串  ·  js ...·  1 年前    · 
温文尔雅的圣诞树  ·  Spring Boot ...·  1 年前    · 
#!/bin/bash
JSON_STR='{"Some":"JSON","Data":"Here"}'
curl -x PUT "http://localhost:port/api/url" -d $JSON_STR

现在,如果我用curl命令来检查一下,看看它看起来像什么

echo curl -x PUT "http://localhost:port/api/url" -d $JSON_STR

Everything looks fine:

curl -x PUT "http://localhost:port/api/url" -d '{"Some":"JSON","Data":"Here"}'

但API正在抱怨转义符的问题,它看到了

'{\"Some\":\"JSON\",\"Data\":\"Here\"}'

现在我明白了为什么它们会在那里(转义符),但我如何在脚本命令中去掉它们呢?在bash中是否有一个原始字符串?