Work around a bug in netcat
This commit is contained in:
parent
3d9ad47064
commit
addddffddc
1 changed files with 3 additions and 5 deletions
8
irc-bot
8
irc-bot
|
@ -1,8 +1,6 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Super simple IRC bot.
|
||||
#
|
||||
# Note: Requires the OpenBSD version of netcat!
|
||||
|
||||
NICK="bitlair-space"
|
||||
CHANNEL="#bitlair-test"
|
||||
|
@ -23,13 +21,13 @@ echo "JOIN $CHANNEL"
|
|||
# FIXME: Possible race condition between loop and stdin.
|
||||
tail -f "$loop" &
|
||||
|
||||
nc -6 -k -lp "$INPORT" | while read line; do
|
||||
echo "NOTICE $CHANNEL $line"
|
||||
while true; do
|
||||
echo "NOTICE $CHANNEL $(nc -lp "$INPORT")"
|
||||
done
|
||||
} | \
|
||||
nc "$SERVER" 6667 | while read message; do
|
||||
case "$message" in
|
||||
PING*) echo "PONG ${message#PING :}" | tee "$loop";;
|
||||
PING*) echo "PONG ${message#PING :}" > "$loop";;
|
||||
ERROR*) echo "$message"; exit;;
|
||||
*PRIVMSG*) echo "${message}" | sed -nr "s/^:([^!]+).*PRIVMSG[^:]+:(.*)/[$(date '+%R')] <\1> \2/p";;
|
||||
*) echo "${message}";;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue