开发者

How to send commands to telnet and leave session open [closed]

开发者 https://www.devze.com 2023-01-17 23:40 出处:网络
Closed. This question is off-topic. It is not currently accepting answers. 开发者_JAVA百科 Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed. This question is off-topic. It is not currently accepting answers.
开发者_JAVA百科

Want to improve this question? Update the question so it's on-topic for Stack Overflow.

Closed 12 years ago.

Improve this question

I have to connect to a remote server via telnet and want to send file input there.

This is a processor emulator (MCF68k), so I can't just scp the file to the server and run from there.

I can send input like this:

telnet host.name < input.file

Which will successfully transmit the data to the server and run the commands stored that I want. However, I need the telnet session to stay interactive (not terminate).

How do I pipe a file to a command, then return control of stdin to the terminal and keep the interactive session open?

Very Late Edit:

I think this can be done using expect:

man expect: http://www.manpagez.com/man/1/expect/

python wrapper: http://www.noah.org/wiki/pexpect


Does cat input.file - | telnet host.name work?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号