是否可以在〜/ .ackrc中添加-G选项 [英] Is it possible to add a -G option to ~/.ackrc
问题描述
当我这样做时
ack -G "^.*$" "foo"
我得到结果...但是当我放
I get results... but when I put
-G "^.*$"
或
-G="^.*$"
或
-G
"^.*$"
在我的〜/ .ackrc /中我没有结果...有人知道-G是否可以在ackrc中使用吗?
in my `~/.ackrc/ I get no results... Does anyone know if -G can be used in ackrc?
推荐答案
这是一个引用问题。在命令行上执行时:
It's a quoting problem. When executed on the command line:
$ ack -G="^.*$"
ack实际上看到了以下命令行选项(在Shell进行报价处理之后)
ack actually sees the following command line option (after quote processing by the shell)
-G=^.*$
不带引号。由于读取〜/ .ackrc
文件时不进行外壳引号处理,因此请将上面的不带引号的行放在〜/中。 ackrc
。
without the quotes. Since the ~/.ackrc
file is read without shell quote processing, place the above line without quotes into ~/.ackrc
.
更新:这只是其中的一半。看来您需要在〜/ .ackrc
中使用以下行:
Update: That was only half of it. It looks like you need to use the following line in ~/.ackrc
:
-G^.*$
我不确定为什么 =
不允许在其中使用,但包括它使其成为模式的一部分,这显然不是您想要的。
I'm not completely sure why the =
is not permitted there, but including it makes it part of the pattern, which is obviously not what you want.
这篇关于是否可以在〜/ .ackrc中添加-G选项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!