summaryrefslogtreecommitdiff
path: root/examples/chat/tlsd-chat.sh
diff options
context:
space:
mode:
Diffstat (limited to 'examples/chat/tlsd-chat.sh')
-rwxr-xr-xexamples/chat/tlsd-chat.sh15
1 files changed, 15 insertions, 0 deletions
diff --git a/examples/chat/tlsd-chat.sh b/examples/chat/tlsd-chat.sh
new file mode 100755
index 0000000..a1064a4
--- /dev/null
+++ b/examples/chat/tlsd-chat.sh
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+NAME="${ALIAS}[$$]"
+
+quit () {
+ echo "$(date -u +%R) * ${NAME} quits" | nc localhost 7000
+}
+trap quit EXIT
+
+JOINMSG="$(date -u +%R) * ${NAME} joins"
+echo "${JOINMSG}"
+echo "${JOINMSG}" | nc localhost 7000
+while read -r LINE
+do echo "$(date -u +%R) ${NAME}: ${LINE}"
+done | stdbuf -oL tr -d '\000-\011\013-\037' | nc localhost 7000