How to pipe output of tail -F on OS X?

7,069

See https://apple.stackexchange.com/questions/9673/how-to-correctly-pipe-output-into-say-in-terminal which suggests

 tail -f xyzzy.log | while read line ; do echo $line | say ; done
Share:
7,069
slhck
Author by

slhck

Updated on September 18, 2022

Comments

  • slhck
    slhck over 1 year

    I've recently moved from Ubuntu to OS X and I'm finding that the 'tail' command behaves differently.

    On Ubuntu I could run

    tail -f xyzzy.log | espeak
    

    (To have the computer read me what's happening on IRC, for example.)

    However on OS X

    tail -F xyzzy.log | say
    

    (which I expected to be equivalent) produces no result.

    Presumably this is because the pipe wants to send the complete output of tail to say, but since tail is running constantly (with -f) it never reaches the end of the process and so the output never gets passed to say. Honestly, if I'm understanding this right, this behaviour makes more sense than the behaviour I had on Ubuntu -- it's just less useful.

    So is there another way I can achieve the same result? (And are my presumptions about why this is happening correct?)