I try to catch a SIGINT ctrl+c inside a read loop on a socket but the break I'm asking for only get processed after a new line. So when I ctrl+c my running app, I have to wait for a new line to arrive in the socket before the loop breaks / the app exits
This is the minimal version :
trap "break" SIGINT SIGHUP SIGTERM
exec 3<>/dev/tcp/192.168.1.84/50885
while read line
do
echo -e "$line\n"
done <&3
How can I immediately break the loop and exit the app?