Skip to content

Instantly share code, notes, and snippets.

@mcpcpc
Last active October 30, 2020 21:45
Show Gist options
  • Save mcpcpc/d40eb3ce2c01e49144ef7f75f7776c10 to your computer and use it in GitHub Desktop.
Save mcpcpc/d40eb3ce2c01e49144ef7f75f7776c10 to your computer and use it in GitHub Desktop.
kirc notifications
#!/bin/sh
#
# checks log file for substring, usually your own nick, and sends message to specified program.
# message notification includes the senders nick.
main () {
while true; do
tail -fn5 "$1" | awk '/PRIVMSG #.*nick.*/ {
sub(/:/,""); sub(/!/," "); print "\x27" $1 " - new message" "\x27"
exit
}' | xargs herbe
sleep 5
done
}
main "$1"
@mcpcpc
Copy link
Author

mcpcpc commented Oct 30, 2020

Usage

sh notify.sh mylogfile.log

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment