-
Notifications
You must be signed in to change notification settings - Fork 11
/
ubusecrss
27 lines (22 loc) · 1.18 KB
/
ubusecrss
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/bin/bash
#----------------------------------------------------------------------------------
# Project Name - miscellaneous/ubusecrss
# Started On - Fri 9 Feb 19:48:37 GMT 2018
# Last Change - Fri 9 Feb 19:58:42 GMT 2018
# Author E-Mail - [email protected]
# Author GitHub - https://github.com/terminalforlife
#----------------------------------------------------------------------------------
# Not entirely sure where I'm going with this, but it'll output the titles and HTTP
# URLs for them, of the Ubuntu security RSS feed, by parsing the initial page. I
# had in mind a notifier for when RSS feeds arrive and are new.
#----------------------------------------------------------------------------------
XERR(){ printf "[L%0.4d] ERROR: %s\n" "$1" "$2" 1>&2; exit 1; }
[ -x /usr/bin/wget ] || XERR "$LINENO" "Dependency '/usr/bin/wget' not met."
URL="https://usn.ubuntu.com/usn/rss.xml"
while IFS=">" read -a X; do
if [[ "${X[0]}" =~ ^\</description ]]; then
[ "${X[6]}" -a "${X[2]%<*}" ] || continue
printf "%s\n%s\n\n" "${X[6]}" "${X[2]%<*}"
fi
done <<< "$(/usr/bin/wget -q "$URL" -O -)"
# vim: noexpandtab colorcolumn=84 tabstop=8 noswapfile nobackup