.git/config
中的此别名:
pycat = !find -iname '*.py' -exec cat {} \;
在 shell 中给我这个:
$ git pycat
fatal: bad config file line 19 in .git/config
我尝试过引用、不引用、切换引用类型、将所有内容转义到四个级别,但我无法弄清楚是什么让 git 在这里不高兴。
最佳答案
稍微放屁说这是分号,
pycat = !find -iname '*.py' -exec cat {} "\\;"
pycat = !find -iname '*.py' -exec cat {} "';'"
pycat = "!find -iname '*.py' -exec cat {} \\;"
pycat = "!find -iname '*.py' -exec cat {} \";\""
所有工作。分号是老式的注释到 eol 语法,这可能就是这里发生的情况。所以配置解析器吃掉了一层双引号。
(编辑:yup。它甚至在文档中这么说:
The syntax is fairly flexible and permissive; whitespaces are mostly ignored. The # and ; characters begin comments to the end of line, blank lines are ignored.
)
关于git - git 别名中的 `find -exec`,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24216116/