I'm not sure if this is the right section, but I am trying to get my shell to display the latest FreeBSD news at login.
however, characters are missing from the news, probably due to the way I used sed. (Which I am no good at)
Example:
And the code snippet:
however, characters are missing from the news, probably due to the way I used sed. (Which I am no good at)
Example:
And the code snippet:
Code:
if [ "$PS1" ]; then
# The characters "£, §" are used as metacharacters. They should not be encountered in a feed...
echo -e "$(echo $(curl --silent http://www.freebsd.org/news/rss.xml | sed -e ':a;N;$!ba;s/\n/ /g') | \
sed -e 's/&/\&/g
s/<\|</</g
s/>\|>/>/g
s/<\/a>/£/g
s/href\=\"/§/g
s/<title>/\\n\\n\\n :: \\e[01;31m/g; s/<\/title>/\\e[00m ::\\n/g
s/<link>/ [ \\e[01;36m/g; s/<\/link>/\\e[00m ]/g
s/<description>/\\n\\n\\e[00;37m/g; s/<\/description>/\\e[00m\\n\\n/g
s/<p\( [^>]*\)\?>\|<br\s*\/\?>/\n/g
s/<b\( [^>]*\)\?>\|<strong\( [^>]*\)\?>/\\e[01;30m/g; s/<\/b>\|<\/strong>/\\e[00;37m/g
s/<i\( [^>]*\)\?>\|<em\( [^>]*\)\?>/\\e[41;37m/g; s/<\/i>\|<\/em>/\\e[00;37m/g
s/<u\( [^>]*\)\?>/\\e[4;37m/g; s/<\/u>/\\e[00;37m/g
s/<code\( [^>]*\)\?>/\\e[00m/g; s/<\/code>/\\e[00;37m/g
s/<a[^§]*§\([^\"]*\)\"[^>]*>\([^£]*\)[^£]*£/\\e[01;31m\2\\e[00;37m \\e[01;34m[\\e[00;37m \\e[04m\1\\e[00;37m\\e[01;34m ]\\e[00;37m/g
s/<li\( [^>]*\)\?>/\n \\e[01;34m*\\e[00;37m /g
s/<!\[CDATA\[\|\]\]>//g
s/\|>\s*<//g
s/ *<[^>]\+> */ /g
s/[<>£§]//g')\n\n";
fi