I'm trying to follow various answers in this, this and this threads, but my pipeline still appears buffered. Here's an example attempt:
unbuffer sh -c 'echo -n test; sleep 1; echo; sleep 1; echo -n hello; sleep 1; echo' | grep .
The above command should immediately print test
, then after on second print hello
, and after one more second end. Instead, I get a one-second delay, only then test
, then, after a two-second delay, hello
with command exit.
Note that here I'm trying to completely get rid of buffering, and --line-buffered
option of grep
won't help. So, how do I truly unbuffer this pipeline?