I have two bash processes running. Let's name them bash_1 and bash_2. I wish to execute command in bash_1 from bash_2. I am following this method to achieve this.
Get the dev file for IO in bash_1
vchandola@mininet-server:~$ echo $$
1097
vchandola@mininet-server:~$ ls -alh /proc/1097/fd
total 0
dr-x------ 2 vchandola vchandola 0 Jul 11 15:48 .
dr-xr-xr-x 9 vchandola vchandola 0 Jul 11 15:48 ..
lrwx------ 1 vchandola vchandola 64 Jul 11 15:48 0 -> /dev/pts/2
lrwx------ 1 vchandola vchandola 64 Jul 11 15:48 1 -> /dev/pts/2
lrwx------ 1 vchandola vchandola 64 Jul 11 15:48 2 -> /dev/pts/2
lrwx------ 1 vchandola vchandola 64 Jul 11 16:08 255 -> /dev/pts/2
Execute following in bash_2 to execute commands in bash_2 to execute bash commands in bash_1
root@mininet-server:/home/vchandola# socat - /dev/pts/2
hello
ls
I was expecting responses of these in bash_2 but don't see them. In bash_1 both the strings have came but looks like Enter/newline character is not read/served as expected. This is what I see in bash_1
vchandola@mininet-server:~$ hello
ls
Why hello and ls commands were not executed in bash_1? What can I do to execute hello and ls in bash_1?