Now I am guessing the problem was this: if I use
echo $a > pipe1
The named pipe will be closed once the command is completed, and hence close the server as well (because the server [bash -i] relies on these named pipes to be the input and output.
Therefore, I am trying this now:
while true; do
echo $a >&5
I am trying to keep the named pipes open by using "exec 5>pipe1" and "exec 6<pipe2", but this time I got a deadlock in the line "cat <&6" after receiving some output from the server.
It seems that keeping the pipes open is not a good idea.
Actually, I tried using 2 terminals, with one running "cat pipe2" and one running "cat >pipe1" and I succeeded. However, what I actually want to do is to have a client remotely controlling the server as if working on the server.