While piping a command's output to other command, what if the other command exits?

0

nc -q -1 -lk -p 8080 < pipe | nc example.com 8080 > pipe

This is the command I'm working on. It mostly works fine, but sometimes connection to example.com is reset due to lower signal etc. and it stops working. How could I make it reconnect ? I did not see any option about reconnecting on error, but I believe this is possible to achieve with bash. Am I wrong ?

user696534

Posted 2017-02-11T20:48:31.757

Reputation:

Your command looks broken. Since pipe is used for both < pipe and > pipe, it will be truncated before any data is read from it. – janos – 2017-02-12T09:53:14.040

it works as I expected. how could it be broken ? pipe is a fifo – None – 2017-02-12T09:59:28.563

No answers