Let's say that I start a cat
process to wait for some input. e.g.,
$ cat > out.log
In another terminal, I can identify its PID and feed data into its File Descriptor 0 (zero = STDIN), like this:
$ echo "hello" > /proc/2357/fd/0
And then the first terminal reacts:
$ cat > out.log
hello
A couple of questions:
1)The "hello" string shows up in the actual terminal instead of being redirected to the file, is that due to the nature of the cat
program (it just focuses on the tty/foreground)?
2) I can't tail the STDOUT of that same process:
tail -f /proc/2357/fd/1
...
Nothing shows up. Any conjectures on what is going on here?
tee
command either. I've also triedcat | tee output.txt
and checked thestdout = /proc/<PID>/fd/1
of thetee
process, but there's no reaction in mytail -f
. Thoughts? – theMarceloR Jul 01 '18 at 15:16