Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在使用 ack 并且我想避免搜索任何具有名称 test 的文件。我怎么做?
以下确保仅搜索名称为 test 的文件或目录。我想要反转它。
ack foo --rb -G test
ack -G '^(?!test$)' ack -G '^(?!.*test)'
使用第一个忽略完全命名的文件test。使用第二个忽略包含单词test任何地方的文件。
test
如果您想永久忽略测试文件,您可以is_searchable在 ack 脚本中编辑该函数。这是过滤掉核心转储、交换文件等的例程。
is_searchable