bash unix socket

This commit is contained in:
Alexander Popov 2023-06-18 22:04:38 +03:00
parent c07cd75d39
commit 0575eaa4cc
Signed by: iiiypuk
GPG Key ID: E47FE0AB36CD5ED6
1 changed files with 17 additions and 0 deletions

17
~/Bash/unix-socket-server.sh Executable file
View File

@ -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"