I am using the following to send and receive from a TCP socket:
exec 3<>/dev/tcp/localhost/port echo -e "textcommand\r" >&3 cat <&3 exec 3<&-;exec 3>&-
The cat <&3 line displays the response from the localhost in the terminal, but I have to use Ctrl+d or Ctrl+c to return to the command line. How can I print the response from localhost and return to the command line without any keyboard interaction?
(echo -en "textcommand\r"; sleep 1) | telnet localhost port
The above works as an alternative. Found this here: https://stackoverflow.com/a/24204924/5900282
There was a similar issue here: Capturing data from a Fluke 1620a via Bash /dev/tcp file descriptor