From 0575eaa4ccfcc5fa0d513d61d524bb2ac3715498 Mon Sep 17 00:00:00 2001 From: Alexander Popov Date: Sun, 18 Jun 2023 22:04:38 +0300 Subject: [PATCH] bash unix socket --- ~/Bash/unix-socket-server.sh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100755 ~/Bash/unix-socket-server.sh diff --git a/~/Bash/unix-socket-server.sh b/~/Bash/unix-socket-server.sh new file mode 100755 index 0000000..e60ad54 --- /dev/null +++ b/~/Bash/unix-socket-server.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +# TCP +#coproc nc -l localhost 3000 + +# UnixSocket +coproc nc -l -U ./app.sock + +while read -r cmd; do + case $cmd in + d) date ;; + q) break ;; + *) echo 'Try again?' + esac +done <&"${COPROC[0]}" >&"${COPROC[1]}" + +kill "$COPROC_PID"