Skip to content

回复:JSON-RPC 密码 ​

原始发布页

打开来源页面
查看 1 个交叉存档

引用自:gavinandresen,2010 年 7 月 21 日 12:11:10 PM

我刚快速查看了我的 Debian 系统中 /etc 下的 20 个 .conf 文件,发现: 1 个文件使用“key value” 5 个使用“key=value”

谢谢你做的调查!

我觉得“key value”有点不自然。键和值之间应该有一个更明确、能表示赋值的分隔符。用空格的人可能只是懒得多写,直接用了他们所用语言的 split 函数。 key=some full sentence with spaces in it. # 似乎更清楚 key some full sentence with spaces in it. # 比这个更清楚

那好吧,就采用自行解析的 mapConfig,语法为: # 注释 key=value

文件扩展名用 .conf。文件名是什么,是 ~/.bitcoin/settings.conf、~/.bitcoin/bitcoin.conf,还是别的?

我想我们最好去掉键和值开头和结尾的空白字符。 # 喜欢按列对齐的用户 k = value key = value longerkey = this sentence would be this # “this sentence would be this” key = value # 我想这样也可以 nextkey = value right = justified

常规语法应该是“key=value”,但也不能怪人们偶尔写成“key = value”。

英文原文 ​

展开英文原文

Quote from: gavinandresen on July 21, 2010, 12:11:10 PM

I just did a quick survey of 20 .conf files in /etc on my debian system, and found: 1 file used "key value" 5 used "key=value"

Thanks for that survey!

I find "key value" a little unnatural. There ought to be a more definite separator between key and value that suggests assignment. The space people may just be getting lazy using their language's split function. key=some full sentence with spaces in it. # seems more clear key some full sentence with spaces in it. # than this

Allright then, lets go with self-parsed mapConfig, syntax: # comment key=value

file extension .conf. What's the filename, is it ~/.bitcoin/settings.conf or ~/.bitcoin/bitcoin.conf or what?

I think we better strip whitespace at the beginning and end of the key and the value. # user who likes column formatted k = value key = value longerkey = this sentence would be this # "this sentence would be this" key = value # guess this is ok too nextkey = value right = justified

The normal syntax should be "key=value", but you can't blame people for the occasional "key = value".

为历史保存,为中文读者整理。每篇档案均附来源与英文原文。