Is it possible to add a -G option to ~/.ackrc

≡放荡痞女 提交于 2019-12-10 20:05:22

问题


When I do

ack -G "^.*$" "foo"

I get results... but when I put

-G "^.*$"

or

-G="^.*$"

or

-G
"^.*$"

in my `~/.ackrc/ I get no results... Does anyone know if -G can be used in ackrc?


回答1:


It's a quoting problem. When executed on the command line:

$ ack -G="^.*$"

ack actually sees the following command line option (after quote processing by the shell)

-G=^.*$

without the quotes. Since the ~/.ackrc file is read without shell quote processing, place the above line without quotes into ~/.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.




回答2:


You could alias ack to ack -G ?



来源:https://stackoverflow.com/questions/5425363/is-it-possible-to-add-a-g-option-to-ackrc

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!