1

1.Create named PIPEs, pipe_in and pipe_out by running:

$ mkfifo pipe_in
$ mkfifo pipe_out

2.Connect pipe_in to pipe_out:

TERM0: $ tail -f pipe_in > pipe_out

3.Send string hello world! to pipe_in and expect it to arrive at pipe_out:

TERM1: $ tail -f pipe_out
TERM2: $ echo "hello world!" > pipe_in

I can only see the string arriving at pipe_out if I kill command in 2.. It seems to be a buffering issue so I decided to run all commands above with stdbuf -i0 -e0 -o0 <command> but it didn't work.

  • 1
    Good point, @Jeff Schaller. I have just deleted that question. I find this one, here, more fundamental. As soon as I solve this one I will likely be able to solve the other one too. – fmagno Mar 11 '19 at 16:41
2

tail only outputs the last n lines of a file/stream. While you are still generating lines, it can not know which are the last n.

Have you tried something like cat?

|improve this answer|||||
  • It is interesting though that the tail from one pipe to the other works as expected :) – gmagno Mar 11 '19 at 18:43
0

Please refer to @ctrl-alt-delor's answer for the reason why it doesn't work. But you can still achieve the same purpose with cat:

enter image description here

|improve this answer|||||
  • It is very interesting that it works on your setup. On my setup it doesn't. I am running this on OSX, btw - not sure if it should make any difference, though... Altough, if I replace both tail commands by cat it all works fine. – fmagno Mar 12 '19 at 10:34
  • exactly, that is also puzzling me... – gmagno Mar 12 '19 at 11:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.