Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No output when run in a loop. #474

Closed
tthomas7 opened this issue Jul 18, 2014 · 8 comments
Closed

No output when run in a loop. #474

tthomas7 opened this issue Jul 18, 2014 · 8 comments

Comments

@tthomas7
Copy link

Redirecting stdin from a file works as expected but piping from another command returns immediately as if nothing was found.

while read -r line; do Ack "$line"; done < search_terms
finds the search terms listed in the file.

cat search_terms | while read -r line; do Ack "$line"; done;
returns immediately.

@petdance
Copy link
Collaborator

Why are you calling Ack instead of ack?

@tthomas7
Copy link
Author

that's a good question. I didn't know there was a difference

@petdance
Copy link
Collaborator

Might be, might not be. Do you have some sort of Ack alias that aliases to ack or something? What OS are you on? Do you just have a case-insensitive filesystem?

@tthomas7
Copy link
Author

I'm using OSX and zsh, it is case insensitive I believe. I just tried LS and that works and ack doesn't change the behavior.

@ghost
Copy link

ghost commented Jul 18, 2014

@tthomas7 that's a good question. I didn't know there was a difference

On Linux and other Unixoid systems there is a difference between lowercase and uppercase command.

@petdance
Copy link
Collaborator

The Mac HFS+ filesystem is case-insensitive, by default I believe, so that explains that.

@hleeldc
Copy link

hleeldc commented Jul 18, 2014

I think it has something to do with this line: https://github.com/petdance/ack2/blob/dev/Ack.pm#L47

$is_filter_mode = -p STDIN;

This evaluates to 1 (true) when STDIN is from a pipe. Because of this, ack expects data to search from STDIN.

@petdance
Copy link
Collaborator

So this is our old nemesis "figuring out if we're filtering or not".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants