【发布时间】:2018-10-18 17:26:03
【问题描述】:
我有这个查找命令:
find . -type f -not -path '**/.git/**' -not -path '**/node_modules/**' | xargs sed -i '' s/typescript-library-skeleton/xxx/g;
出于某种原因,它给了我这些警告/错误:
find: ./.git/objects/3c: No such file or directory
find: ./.git/objects/3f: No such file or directory
find: ./.git/objects/41: No such file or directory
我什至尝试过使用:
-not -path '**/.git/objects/**'
得到了同样的结果。有人知道为什么 find 在 .git 目录中搜索吗?看起来很奇怪。
【问题讨论】:
-
-name .git -prune会更有效率。使用-not -path ...告诉find忽略匹配该值的文件,但它不会告诉它避免递归目录。 -
查看stackoverflow.com/questions/37047322/… 以获取默认
-print和显式-print行为不同的问题示例,回复:为什么find ...和find ... -print实际上并不相同它涉及否定逻辑。
标签: bash shell sed pipe find-util