3
rated 0 times
[
3]
[
0]
/ answers: 1 / hits: 2417
/ 2 Years ago, mon, october 17, 2022, 10:09:34
I can't get the following bash script to stay open after the first message is received from NC:
#!/bin/bash
port=3333
nc -l $port | while read msg; do notify-send Alert "$msg"; done
After the first message it exits. I want it to stay open and continue monitoring for new messages from NC.
I know that if I launch nc -l port
without the while loop it stays open and I can chat away between the two connections even disconnect from the connected host.
I am sending the message using:
echo 'done' | nc IP port
More From » networking