Redirect process stdin and stdout to netcat

前端 未结 3 1122
时光说笑
时光说笑 2021-02-10 09:28

I have an embedded linux application with a simple interactive command line interface.

I\'d like to access the command line from telnet (or network, in general).

3条回答
  •  情深已故
    2021-02-10 10:07

    I found that by using bash v. >= 4.0 I can use coproc:

    #!/bin/bash
    
    coproc myapp
    nc -kl -p 4000 <&"${COPROC[0]}" >&"${COPROC[1]}"
    

    EDIT

    I eventually incorporated a telnet server in my cli library. You can find the result on GitHub: https://github.com/daniele77/cli

提交回复
热议问题