Inter-process communication without FIFOs

后端 未结 5 1799
一向
一向 2021-01-31 22:16

Inside a BASH script we can have multiple processes running in background which intercommunicate using named pipes, FIFOs registered on the filesystem. An example of this could

5条回答
  •  没有蜡笔的小新
    2021-01-31 23:10

    I just want to point out that ugly hacks didn't wish to be born that way.

    Part which receives data:

    node -e "require('net').createServer(function(s){s.pipe(process.stdout)}).listen(1337)"
    

    Part which sends data:

    echo "write clean code they said" > /dev/tcp/localhost/1337
    echo "it will pay off they said" > /dev/tcp/localhost/1337
    

    Works even in MSysGit's Bash for Windows, to my surprise.

提交回复
热议问题