To answer your clarified question, a simple way is to use FIFO (named pipe) for the job. When sending the terminal:
mkfifo ./myfifo read var echo "var" > myfifo
On the receiving terminal:
read line < ./myfifo
To just print another xterm from your own, in getting xterm:
$ tty /dev/pts/2
When sending xterm:
$ echo howdy doody > /dev/pts/2
Or from a script in the sending xterm, redirecting stdin as you requested:
$ cat > /dev/pts/2
You have chmod write permissions in / dev / pts / 2 if you do this through users.
You cannot fix what is printed in this way on the receiving terminal. There is no built-in redirection method to capture input from another terminal.
If you need an automated way to send xterm to recognize the character device of the receiver, which can be answered in several ways, depending on what kind of communication between the processes you want to use. A simple hack would be for the receiver to do tty> file1 and the sender to do echo what> $ (cat file1).
If you want to try to forward this from the receiver instead of the sender, again you will have a communication problem between processes that can be solved in several ways.
source share