#!/bin/bash # # AUTHOR - Raman Sailopal # # Script to check web page for news alerts i.e. viruses or hacks # if [ "$#" != "4" ] then echo "usage: ./newschk.sh -p \"http://www.linux-magazine.com/Online/News\" -t \"Virus\"" exit fi if [ "$1" != "-p" ] || [ "$3" != "-t" ] && [ "$1" != "-t" ] || [ "$3" != "-t" ] then echo "usage: ./newschk.sh -p \"http://www.linux-magazine.com/Online/News\" -t \"Virus\"" exit fi if [ "$1" == "-p" ] then payge=$2 elif [ "$3" == "-p" ] then payge=$4 fi if [ "$1" == "-t" ] then txt=$2 elif [ "$3" == "-t" ] then txt=$4 fi resp=$(curl -s $payge | grep -i $txt) if [ "$(echo $resp)" == "" ] then echo "No News" exit 0 else echo "News Alert - Go to $payge" exit 2 fi exit