我偶然发现了这种行为,想知道它是否是有意为之和/或记录在案的,因为我找不到任何东西。
我的 ssh 版本的联机帮助页指出ssh_config
/ Include
:
Include 指令可能出现在 Match 或 Host 块内以执行条件包含。
给定以下文件:
# ~/.ssh/config
Host doesnotexist.nonexistanttld
Include ~/.ssh/inc
# ~/.ssh/inc
Match host * exec "touch do-not-touch"
我可以观察到这一点:
$ ssh foo
ssh: Could not resolve hostname foo: nodename nor servname provided, or not known
$ ls
do-not-touch
原因似乎是这样的:
debug3: $HOME/.ssh/config line 2: Including file $HOME/.ssh/inc depth 0 (parse only)
debug2: checking match for 'host * exec "touch do-not-touch"' [...]
(注意parse only
)
我没想到会发生这种事。话又说回来,这是故意的吗?与仅读取、解析和执行实际包含的文件中的匹配相比,是否有充分的理由?