Reputation: 3643
Just a simple question: Why following one-linear not working? How to make IO non blocking?
$ while true; do date; sleep 1; done | tail -f
Upvotes: 1
Views: 585
Reputation: 6992
If what you want to do is continually replace the last line with the date you could do this:
while true; do echo -en "\r"`date`; sleep 1; done
Upvotes: 1
Reputation: 83235
The problem is not with non-blocking IO; it's with your choice of tail
.
This prints out each line with a colon (all of them):
while true; do date; sleep 1; done | grep :
The problem with tail
is that it goes to the last 10 ten lines and then starts following. But in your case, it never reaches the end, so it can't print the last ten.
Upvotes: 2