简体   繁体   English

没有*的Ack / Ag不会返回搜索结果

[英]Ack/Ag does not return search result without *

I am trying to search text in a directory and it turned out that the following syntaxes do not return any result 我试图在目录中搜索文本,结果发现以下语法不返回任何结果

ack -i "0xabcdef" ./

ack -i "0xabcdef"

ack -i "0xabcdef" .

while the following command works 虽然以下命令有效

ack -i "0xabcdef" *

Can someone explain why that is the case? 有人可以解释为什么会这样吗? What is the significance of * . *的意义是什么。 I also noticed that the directory has symbolic links 我还注意到该目录具有符号链接

You should not have to specify a directory to ack. 您不必指定要确认的目录。 By default it delves into the current directory. 默认情况下,它会进入当前目录。

I also noticed that the directory has symbolic links 我还注意到该目录具有符号链接

Then an excellent thing to do would be to look at the manual (either man ack or ack --man ) and search for "link". 然后要做的一件很棒的事情是查看手册( man ackack --man )并搜索“ link”。 The first thing you'll find is this option: 您会发现的第一件事是此选项:

   --[no]follow
       Follow or don't follow symlinks, other than whatever starting files
       or directories were specified on the command line.

       This is off by default.

This means if you want ack to follow symlinks, you need to specify the --follow option. 这意味着如果您希望ack遵循符号链接,则需要指定--follow选项。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM