Home > Software design >  Pass argument into telnet in Bash
Pass argument into telnet in Bash

Time:01-22

How do you pass arguments in telnet using bash. When I tried to push I keep getting an error.

Input

echo "status" | telnet localhost 5555 > /tmp/text.txt

Output

Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Connection closed by foreign host.

I was expecting the output to redirected to a file for parsing however I am recieving an error.

CodePudding user response:

Telnet can't do what you are trying to do. See full explanation in this posting.

CodePudding user response:

Thank you for the response. I was able to get the output however I had to add quit directive to get out of nc from bash. Here is my statement

echo "status" | nc -w 2 localhost 5555 > /tmp/test.txt
  • Related