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.

Rui F Ribeiro
  • 55,929
  • 26
  • 146
  • 227
fmagno
  • 113
  • 2
  • 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 Answers2

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?

ctrl-alt-delor
  • 27,473
  • 9
  • 58
  • 102
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

gmagno
  • 101
  • 3
  • 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