#!/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中是否有一个原始字符串?