#!/bin/bash while(true); do read -n1 VAL echo $VAL|nc -u 127.0.0.1 4950 -q0 if [ "$VAL" == "p" ]; then exit 1; fi done