blob: a8c1fc1b288ff2e2944e1b8dc38fcbf583446003 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
#!/bin/sh
if [ -z "$5" ]
then
printf '%s: Five arguments are required: Hostname, port, username, password and channel.\n' "$0" > /dev/stderr
exit 1
fi
rm cow
printf 'LOGIN\tUSERNAME=%s\tPASSWORD=%s\r\n' "$3" "$4" > cow
(tail -n 1 -f cow | nc "$1" "$2") &
ncid="$!"
trap "kill $ncid" EXIT
while read r
do
printf 'CHANMSG\tTARGET=%s\tMESSAGE=%s\r\n' "$5" "$r" >> cow
done
# this little part doesn't work because sigint isn't caught
kill "$ncid"
|