beyondgrep / ack2

**ack 2 is no longer being maintained. ack 3 is the latest version.**
https://github.com/beyondgrep/ack3/
Other
1.48k stars 140 forks source link

ack "$" don't work #645

Closed stephane-archer closed 7 years ago

stephane-archer commented 7 years ago

if i type ack "$" nothing happen why?? ack 2.14 Running under Perl 5.22.1 at /usr/bin/perl

petdance commented 7 years ago

Hard to tell with limited information. Tell me more.

What is in the directory you are in? What exactly do you mean by "nothing happens"?

stephane-archer commented 7 years ago

I'm in my home directory, after typing the command the output i get is: Name of a file\n and it's wait for something indefinitely (It don't show me the match)

petdance commented 7 years ago

Can you please paste exact screenshots or text cut & paste?

Also, how did you install ack?

petdance commented 7 years ago

And has it ever worked for you? Is this the first time you're using ack?

stephane-archer commented 7 years ago

I use ack regulary (it's been one month i replace it from grep) I install it with apt on ubuntu :)

stephane-archer commented 7 years ago

if I type ack " $" it work perfectly or any other regexp, this this one don't work

stephane-archer commented 7 years ago

ack

petdance commented 7 years ago

Are you wanting to find a literal dollar sign? $ is the metacharacter for the end of a line. What if you do ack "\$" or ack -Q "$"?

Could your shell be doing some weird interpretation of that? What if you have ack '$' to avoid any shell interpolation? What if you do echo "$" vs. echo '$'? What shell are you using?

Are you calling ack directly? Are you wrapping it in a shell script at all? What does which ack and whereis ack show?

I think either your shell is doing something goofy or there's something weird with $ being the metacharacter for end of a line.

stephane-archer commented 7 years ago

ack '$' give the same result, I use zsh, which ack give: /usr/bin/ack whereis ack give: ack: /usr/bin/ack /usr/share/man/man1/ack.1p.gz

petdance commented 7 years ago

Somehow I think that your shell is messing with things. What about the other things I asked? What does echo "$" show?

Can you switch to bash and see what happens?

stephane-archer commented 7 years ago

ack "\$" don't work ack -Q "$" search the char $ but not the meta char :)

stephane-archer commented 7 years ago

echo "$" show: $

stephane-archer commented 7 years ago

bash has the same behavior :)

petdance commented 7 years ago

This is a bug that's been fixed since 2.14. You need a newer version. It works fine in 2.16 and 2.18.

The big question is: Why are you acking for $, which is the end of the line? Every line is going to match.

stephane-archer commented 7 years ago

I just wanted to report to you a bug to help. I glad it's fix :) Ubuntu is always terribly late....

petdance commented 7 years ago

But still I wonder: Why are you trying to match against $?

stephane-archer commented 7 years ago

I was matching with " $" to find some useless space on my files and I discover the bug but forgetting to put " " :)