gpt4 book ai didi

linux - 从管道转发数据

转载 作者:太空宇宙 更新时间:2023-11-04 11:52:24 24 4
gpt4 key购买 nike

我想按照下面的顺序做一条管道。数据从 nc 请求返回。

cat myfile | nc 127.0.0.1 1542 | other_app

问题是 cat 很快完成,管道停止并且 other_app 没有转发任何内容。

如何将nc返回的数据传递给other_app?

最佳答案

对于发送/接收基本示例:

在接收器中:

nc -l 8080 > tmp.out

在发件人中:

nc 127.0.0.1 8080 < file 

如果在接收器中除了写入文件之外你还想将输入通过管道传输到另一个“应用程序”你可以使用类似的东西:

nc -l 8080 | tee -a tmp.out | cat

关于linux - 从管道转发数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55651018/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com