Skip to content

Instantly share code, notes, and snippets.

@ramn
Last active May 10, 2017 16:46
Show Gist options
  • Save ramn/5396741 to your computer and use it in GitHub Desktop.
Save ramn/5396741 to your computer and use it in GitHub Desktop.
IRC client in Bash
# Communicate with an IRC channel from the shell
#
# Runs in background, writes messages to stdout in tty
# Depends on sic
TMPF=ircsession.tmp; CHAN='#testircfrombash'; ME=bot001; cat /dev/null > $TMPF; (tail -f $TMPF | sic -h irc.freenode.net -p 6667 -n $ME | while read MSG; do case "$MSG" in "$ME"*) echo ":j $CHAN" >> $TMPF;; "$CHAN"*) echo "$MSG";; esac; done;) &
# Then, to write to the channel:
echo "Hello all!" >> $TMPF
# or open a buffer to write many rows:
cat >> $TMPF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment