File: slashdot.sh

package info (click to toggle)
scripts4ticker 20020720-5
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k, sarge
  • size: 60 kB
  • ctags: 1
  • sloc: sh: 58; makefile: 48
file content (41 lines) | stat: -rwxr-xr-x 873 bytes parent folder | download
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/bin/sh

#  slashdot.sh - downloading the headlines of http://slashdot.org
#
#  Copyright (c) 2001 Seiichi SATO <ssato@sh.rim.or.jp>, licensed under the GPL
#
# <ChangeLog>
#
# 2002 Jul 20
#   * rewritten for fetching rdf file
#   * removed lynx
#
# 2001 October 15
#   * Initial release


URL=http://slashdot.org/slashdot.rdf
OUTPUT=${HOME}/.slashdot

W3M="w3m"
WGET="wget"
LYNX="lynx"
LINKS="links"

if which $W3M > /dev/null 2>&1 ; then
  COMMAND="$W3M -dump"
elif which $WGET> /dev/null 2>&1 ; then
  COMMAND="$WGET --quiet --output-document=-"
elif which $LYNX > /dev/null 2>&1 ; then
  COMMAND="$LYNX -source"
elif which $LINKS > /dev/null 2>&1 ; then
  COMMAND="$LINKS -source"
else
  exit 1
fi

$COMMAND $URL | grep '<title>' | \
		grep -v '<title>Slashdot<\/title>' | \
		grep -v 'Search Slashdot' | \
		sed 's/<title>//g' | \
		sed 's/<\/title>//g ' > $OUTPUT