I want to output some data to a pipe and have the other process do something to the data line by line. Here is a toy example:
mkfifo pipe
cat pipe&
cat &
Honestly, the best way I was able to get this to work was by using socat, which basically connections two sockets.
mkfifo foo
socat $PWD/foo /dev/tty
Now in a new term, you can:
echo "I am in your term!" > foo
# also (surprisingly) this works
clear > foo
The downside is you need socat, which isn't a basic util everyone gets. The plus side is, I can't find something that doesn't work... I am able to print colors, tee to the fifo, clear the screen, etc. It is as if you slave the whole terminal.