chiark / gitweb /
fix backslash handling
[bin.git] / irssi-notify
1 #! /bin/sh
2 set -e
3
4 # Based on:
5 #   http://thorstenl.blogspot.com/2007/01/thls-irssi-notification-script.html
6
7 ssh -n riva irssi-notify-server | \
8         sed -u 's/&/\&amp;/g; s/</\&lt;/g; s/>/\&gt;/g; s/\\/\\\\/g' | \
9         while read heading message; do
10                 case $heading in
11                         .)
12                                 continue
13                                 ;;
14                         LPBUG)
15                                 bug="${message%% *}"
16                                 message="${message#* }"
17                                 imp="${message%% *}"
18                                 message="${message#* }"
19                                 notify-send -i gtk-dialog-info -t 300000 -- \
20                                         "New LP bug $bug ($imp)" \
21                                         "<a href=\"https://launchpad.net/bugs/$bug\">$message</a>"
22                                 ;;
23                         *)
24                                 notify-send -i gtk-dialog-info -t 300000 -- \
25                                         "${heading}" "${message}"
26                                 ;;
27                 esac
28         done