I assume this has nothing to do with ack, but more with bash:
Here we create file.txt, containing the string foobar, so we ackcan find in it foobar:
> echo foobar > file.txt
> echo 'ack foobar file.txt' > ack.sh
> bash ack.sh
foobar
> bash < ack.sh
foobar
So far so good. Buy, why doesn't he find anything in it?
> cat ack.sh | bash
(no output)
or
> echo 'ack foobar file.txt' | bash
(no output)
Why not ackfind foobarin the last two cases?
Adding unbuffer(from expect) in front makes it work, which I don't understand:
> echo 'unbuffer ack foobar file.txt' | bash
foobar
Even a stranger:
> cat ack2.sh
echo running
ack foobar file.txt
echo running again
unbuffer ack foobar file.txt
> bash ack2.sh
running
foobar
running again
foobar
> cat ack2.sh | bash
running
unbuffer ack foobar file.txt
Wassup with this outlet? These are echos unbuffer ack foobar file.txt, but not
running again? A?
source
share