Skip to content

Instantly share code, notes, and snippets.

@mattak
Created April 2, 2014 02:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattak/9926791 to your computer and use it in GitHub Desktop.
Save mattak/9926791 to your computer and use it in GitHub Desktop.
irc post script with a single message.
#!/bin/sh
if [ $# -ne 4 ]; then
echo "usage: <server> <nick> <channel> <message>"
echo "ex: irc.example.com bot #chatroom hello"
exit
fi
SERVER=$1
PORT=6667
NICK=$2
CHANNEL=$3
MESSAGE=$4
HOSTNAME=$(hostname -f)
cat << __IRC__ | telnet $SERVER $PORT
NICK $NICK
USER $NICK $HOSTNAME $HOSTNAME $NICK
JOIN $CHANNEL
NOTICE $CHANNEL $MESSAGE
QUIT
__IRC__
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment