【发布时间】:2021-08-03 04:40:17
【问题描述】:
我有以下在 linux 上运行的代码。 即使 json 格式化程序是正确的,它也会引发很多错误。
curl -o -skd { "jsonrpc": "2.0", "method": "addAction", "params":{"action":{"id": "Syslog","name": "Syslog Action","isSystem": false,"type": "SendSyslogMessage","arguments": [{"key": "SyslogServerName","value": "10.41.155.233"},{"key": "SyslogServerUseTcp","value": "0"},{"key": "SyslogServerUseTls","value": "0"},{"key": "SyslogServerNoBsdCompat","value": "0"},{"key": "SyslogServerCaCertChain","value": ""},{"key": "SyslogServerAllowOffTimeRangeCerts","value": "0"},{"key": "SyslogServerPort","value": "514"}]}},"id": 1}
错误:-
Warning: The file name argument '-skd' looks like a flag.
curl: (3) [globbing] unmatched brace in column 1
curl: (6) Could not resolve host: jsonrpc
curl: (6) Could not resolve host: 2.0,
curl: (6) Could not resolve host: method
curl: (6) Could not resolve host: addAction,
curl: (3) [globbing] nested brace in column 16
curl: (6) Could not resolve host: Syslog,name
curl: (3) Host name 'Syslog Action,isSystem' contains bad letter
curl: (6) Could not resolve host: false,type
curl: (6) Could not resolve host: SendSyslogMessage,arguments
curl: (3) [globbing] bad range specification in column 2
curl: (6) Could not resolve host: SyslogServerName,value
curl: (3) [globbing] unmatched close brace/bracket in column 14
curl: (6) Could not resolve host: SyslogServerUseTcp,value
curl: (3) [globbing] unmatched close brace/bracket in column 2
curl: (6) Could not resolve host: SyslogServerUseTls,value
curl: (3) [globbing] unmatched close brace/bracket in column 2
curl: (6) Could not resolve host: SyslogServerNoBsdCompat,value
curl: (3) [globbing] unmatched close brace/bracket in column 2
curl: (6) Could not resolve host: SyslogServerCaCertChain,value
curl: (3) [globbing] unmatched close brace/bracket in column 1
curl: (6) Could not resolve host: SyslogServerAllowOffTimeRangeCerts,value
curl: (3) [globbing] unmatched close brace/bracket in column 2
curl: (6) Could not resolve host: SyslogServerPort,value
curl: (3) [globbing] unmatched close brace/bracket in column 4
curl: (3) [globbing] unmatched close brace/bracket in column 2
【问题讨论】:
-
当您将整个参数放在单引号中时可能会起作用:
'{ .... .... }'。 -
我试过了,但是还有一个错误。警告:文件名参数“-skd”看起来像一个标志。 curl: (3) [globbing] 第 53 列中的嵌套大括号
-
我明白为什么这个问题被关闭了。我最初没有正确格式化它,看起来也不整洁。 Christian Fritz 编辑了这个问题,现在对我来说看起来不错。这个问题对任何面临这个问题的人都有帮助。请版主或其他人重新打开此页面。谢谢!