我正在运行以下查询
aws dynamodb query `
--table-name user`
--key-condition-expression "datecreated = :d" `
--expression-attribute-values "{ ':d': { 'S': '2018-08-15' } }" --endpoint-url http://localhost:8000
Run Code Online (Sandbox Code Playgroud)
dynamodb甚至不知道双引号是什么吗?
我阅读了我认为所有关于在 PowerShell 中转义字符串的文章,但我仍然没有找到让我满意的解决方案。
假设我有一个foo.json包含 JSON 字符串的文件。我需要将 JSON 字符串作为参数传递给程序。
在 bash 中,这很好用:
myprogram "$(cat ~/foo.json)"
在 PowerShell 中,当我正常读取文件内容并将其传入时,接收程序会抱怨键和值周围没有引号。
我想出的是:
$json = (get-content ~/foo.json | Out-String) -replace '"','""'
myprogram $json
在 PowerShell 中是否有一种不那么尴尬的方法来做到这一点?我已经退出会话,在 bash 中运行命令,然后再次启动会话。