git - git 别名中的 `find -exec`

标签 git find alias

.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/

相关文章:

git - 无法让 TeamCity 使用默认私钥向 GitHub 进行身份验证

git clone --recurse-submodules 记录子模块的绝对路径

Git 强制 merge

linux - 如何使用 find 过滤 ls 输出

android - 在 Android 中为包设置别名

mysql - where 子句中的 SQL 别名

gitolite gitlist : Failed to resolve HEAD as a valid ref

linux - 如何找到只对所有者具有特定权限的文件?

C++ 在 std::vector 中搜索

c++ - 嵌套类中的别名模板