I want to write to something (a named pipe, a socket, idk) and if there is reader listening to the socket, the data will go to the reader(s), otherwise it just gets dumped to /dev/null. Is there some way to do that?
if I write my own unix domain socket server that listens on the socket, then I can accomplish this, but I am wondering if the naked filesystem can do this somehow?
it would be like a named pipe and if the
mkfifo ifnoreadersdump while true; do cat ifnoreadersdump | while read line; do if reader; then echo "$line" > reader else echo "$line" > /dev/null # unnecessary, but for illustrative purposes fi done; done;