There seem to be plenty of similar questions, for example:
However the answer given is to prepare the program beforehand by making its stdin a pipe.
There's also:
Which is answered by commanding a terminal multiplexer under which the program in question is running. That means it also needs prior preparation.
This question is about how to do this without having done any preparation beforehand.
At first I thought it might be as simple as:
echo foo > /proc/$p/fd/0
but that just writes to the terminal. So then I tried:
echo foo > /proc/$terminal_emulator/fd/$ptmx_fd
but that also fails because it just opens up a new terminal device slave for echo.
I already have an answer using gdb
(sigh) which I'll be posting below, but I wonder if anyone knows of a simpler and better alternative.
close
just below your question, thenDuplicate of
, then paste the URL of the duplicate question. – Mark Plotnick Aug 07 '19 at 18:29