【问题标题】:Ack/Ag does not return search result without *Ack/Ag 不返回没有 * 的搜索结果
【发布时间】:2018-01-08 18:45:11
【问题描述】:

我正在尝试在目录中搜索文本,结果发现以下语法不返回任何结果

ack -i "0xabcdef" ./

ack -i "0xabcdef"

ack -i "0xabcdef" .

当以下命令有效时

ack -i "0xabcdef" *

有人可以解释为什么会这样吗? * 的意义是什么。我还注意到该目录有符号链接

【问题讨论】:

    标签: grep ack ag


    【解决方案1】:

    您不必指定要确认的目录。默认情况下,它会深入到当前目录。

    我还注意到该目录有符号链接

    那么最好的办法是查看手册(man ackack --man)并搜索“链接”。你会发现的第一件事就是这个选项:

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

    这意味着如果你想 ack 跟随符号链接,你需要指定 --follow 选项。

    【讨论】:

    • *是什么意思?
    • * 是一个 shell glob 字符,意思是“任何字符串”。我建议您在进一步了解 Unix 命令行之前找到一个很好的介绍。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-05-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-04-30
    • 2023-03-12
    相关资源
    最近更新 更多