SN-1433 已核对来源,附原文与上下文。
其他参与者原话gavinandresen原帖 ↗我刚在我 debian 系统的 /etc 里快速扫了 20 个 .conf 文件,发现:
I just did a quick survey of 20 .conf files in /etc on my debian system, and found:
1 个文件用 "key value"
1 file used "key value"
5 个用 "key=value"
5 used "key=value"
谢谢这份调查!
Thanks for that survey!
我觉得 "key value" 有点不自然。键和值之间应该有一个更明确的、暗示赋值的分隔符。用空格的人,也许只是懒得用他们语言自带的 split 函数。
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. # 看起来比这样清晰
key=some full sentence with spaces in it. # seems more clear
key some full sentence with spaces in it. #
key some full sentence with spaces in it. # than this
那好,就用自解析的 mapConfig,语法:
Allright then, lets go with self-parsed mapConfig, syntax:
# comment
# comment
key=value
key=value
扩展名 .conf。文件名叫什么?~/.bitcoin/settings.conf 还是 ~/.bitcoin/bitcoin.conf 还是别的?
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
k = value
key = value
key = value
longerkey = this sentence would be this # "this sentence would be this"
longerkey = this sentence would be this # "this sentence would be this"
key = value # 猜这样也行
key = value # guess this is ok too
nextkey = value
nextkey = value
right = justified
right = justified
正常语法应该是 "key=value",只不过偶尔有人写 "key = value" 也不能怪人家。
The normal syntax should be "key=value", but you can't blame people for the occasional "key = value".