Redirect process stdin and stdout to netcat

前端 未结 3 2230
清酒与你
清酒与你 2021-02-10 09:43

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

提交回复
热议问题