On 23/11/18 06:54, Ντέντος Σταύρος wrote: > Hello there, > > I have tried to both store command output to a file and show it on the > terminal; hence I used `tee`. > However, I noticed that `tee` does heavy input buffering for my liking > (even on several `\n`). > > What is worse is, the program I use does provide output without a > trailing `\n`, and, for the sake of this example, > "it is highly important" that I can see also partial output. > > If I run the command unpiped to `tee`, then it works fine. > > I searched online, however neither `stdbuf` nor `unbuffer` (from > `expect`) are able to help with the case. > > Would it be easy enough to add a `--no-buffering` flag to `tee` instead? > Or, is there something else I missed from the internet for such operation?
Well tee is implicitly unbuffered. I'm guessing the issue is with the default buffering mode changing of the thing writing through the pipe. I.E. if you replaced tee with cat you'd see the same thing. Can you try using stdbuf on the filter before the tee, i.e.: stdbuf -oL blah | tee blah cheers, Pádraig
