Introduction
Sending messages to an IRC server from a shell script (Bash)
snippet

Sending messages to an IRC server from a shell script (Bash)

This is a helpful little script I found on the net and modified to work around an issue with fast CPUs and slow IRC servers. If you find yourself needing to send messages from a shell script to an IRC server but keep coming against the 451 PRIVMSG: You have not registered error, inserting a sleep between the USER and PRIVMSG commands does the trick.

#!/bin/bash -x
(
echo NICK backoffice
echo USER backoffice 8 * : Notifier
sleep 1
# echo 'JOIN #netops'
echo 'PRIVMSG #netops' $1
echo QUIT
) | nc 127.0.0.1 6667
Rafael
Author

Rafael

Professional site reliability engineer, amateur chef, practicing traveller.

View Comments
Next Post

Jeff Bezos' regret minimization framework

Previous Post

Rebuilding the NAS, (The) Part (That Was) II

Success! Your membership now is active.