英文:
Keep node from stripping \ (Escape slashes) when saving strings?
问题
我有一个包含以下内容的字符串模板:
"echo": "echo \"$PWD\""
当我将模板保存到文件系统时,Node.js会删除转义字符(\
),所以上述情况下的输出将是:
"echo": "echo "$PWD""
我们如何阻止Node.js删除转义字符?
英文:
I have a string template that includes the following:
"echo": "echo \"$PWD\""
When I save the template to the file system, node strips out the escape characters ( \
), so that in the above case the output would be:
"echo": "echo "$PWD""
How do we keep node from stripping the escape characters?
答案1
得分: -1
这起初是起作用的(逃避转义字符)!谢谢Andy!!
"echo": "echo \\\"$PWD\\\""
英文:
This ended up doing the trick (Escape the escape character)! Thanks Andy!!
"echo": "echo \\"$PWD\\""
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论