问题
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