2023-06-18 22:04:38 +03:00
|
|
|
#!/bin/bash
|
|
|
|
|
2023-09-10 01:13:40 +03:00
|
|
|
# TODO: Добавить описание и пример работы
|
|
|
|
|
2023-06-18 22:04:38 +03:00
|
|
|
# TCP
|
2023-08-16 22:01:02 +03:00
|
|
|
# coproc nc -l localhost 3000
|
2023-06-18 22:04:38 +03:00
|
|
|
|
|
|
|
# UnixSocket
|
|
|
|
coproc nc -l -U ./app.sock
|
|
|
|
|
|
|
|
while read -r cmd; do
|
2023-08-16 22:01:02 +03:00
|
|
|
case $cmd in
|
|
|
|
d) date ;;
|
|
|
|
q) break ;;
|
|
|
|
*) echo 'Try again?'
|
|
|
|
esac
|
2023-06-18 22:04:38 +03:00
|
|
|
done <&"${COPROC[0]}" >&"${COPROC[1]}"
|
|
|
|
|
|
|
|
kill "$COPROC_PID"
|