diff options
author | julien | 2009-07-06 17:26:39 +0200 |
---|---|---|
committer | julien | 2009-07-06 17:26:39 +0200 |
commit | 962e19a2bcd0697aa80e5da8b0bf499557219a59 (patch) | |
tree | 2e188f8a6e3c57cffcb88e048b9d8f2e5d2935ac /shbot.sh | |
download | shbot-962e19a2bcd0697aa80e5da8b0bf499557219a59.tar.gz shbot-962e19a2bcd0697aa80e5da8b0bf499557219a59.tar.bz2 shbot-962e19a2bcd0697aa80e5da8b0bf499557219a59.zip |
Initial import
Diffstat (limited to '')
-rwxr-xr-x | shbot.sh | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/shbot.sh b/shbot.sh new file mode 100755 index 0000000..cba3b01 --- /dev/null +++ b/shbot.sh @@ -0,0 +1,27 @@ +#!/bin/bash + +source ./shbirth.sh +exec 3<>/dev/tcp/$SERVER/$PORT +shbirth 1>&3 + +while true +do + read LINE 0<&3 || break + echo "<-- "$LINE + if [[ "$LINE" =~ PING\ *:(.*) ]]; then + echo "PONG :${BASH_REMATCH[1]}" >&3 + sleep 0.1 + else + echo "${LINE}" | ./shbrain.sh | \ + while true + do + read ANSWER || break + echo "--> "$ANSWER + echo $ANSWER >&3 + done + fi +done + +exec 3>&- +exit 0 + |