Sometimes I want to display the contents of the channel in the middle (isn't it all?).
I generally do it like this (yes, I know there are other, possibly better ways):
terminal=$(tty) echo hello world |tee $terminal|awk '{print $2, $1}'
which outputs
hello world world hello
It is beautiful and beautiful in every way.
Except that I really would like to do this without creating a $ terminal variable. You easily say, just replace " tee $terminal " with " tee $(tty) " in the pipe, and there is no need for a variable? Right?
Wrong.
echo hello world |tee $(tty)|awk '{print $2, $1}'
exits
world hello
In other words, my exit from the middle of the pipe was swallowed.
Now I agree that this is definitely the first problem in the world, but it annoys me, and I would like to know why the second solution does not work.
Is anyone
source share