Create your own newspages

Using bash over simplified to create a web page so that you do not have to go to a bunch of web pages and therefore you miss the ads. Update: You can find the similar code for the sub-programs in earlier articles.

Update new section to add to script

#--------------------------------------------------------
# cnn
echo "<h3>CNN Headines</h3>" >> report.html
echo "<pre>" >> report.html
# creates cnn.txt
./cnn.sh > cnn.txt
echo "<pre>" >> report.html
cat cnn.txt >> report.html
echo "</pre>" >> report.html

Original script

#----------------------------------------------
# daily journal
echo "<html>" > report.html
echo "<body>" >> report.html
echo "<script>" >> report.html
echo "var d=new Date();" >> report.html
echo "document.write('<h2> Journal for ');" >> report.html
echo "document.write(d);" >> report.html
echo "document.writeln('</h2>');" >> report.html
echo "</script>" >> report.html
#  echo Journal for: $(date) >> report.html
 echo "<hr>" >> report.html
#------------------------------------------------
# weather
echo "<h3>The weather</h3>" >> report.html
echo "<pre>" >> report.html
# creates tw
gwhtml.sh  20201 >> tw
echo "<pre>" >> report.html
cat tw >> report.html
echo "</pre>" >> report.html
# display weather map
echo "<img src="http://radar.weather.gov/ridge/Thumbs/LWX.png" alt="" width=300 height=450 />" >> report.html
#-------------------------------------------------
# horoscope
echo "<h3>The horoscope</h3>" >> report.html
# creates h
ghphtml.sh virgo > h
echo "<pre>" >> report.html
cat h >> report.html
echo "</pre>" >> report.html
echo "</body>"  >> report.html
echo "</html>" >> report.html




---------
extra:
 ghphtml.sh

#===================================
# Get today's horoscope
# get sign
hsign="virgo"
#-------------------------------------------
# output data
# character width required for information box
cw=38
#create data file (datadir and file name can be changed to your needs.
datadir="/home/eddie/signs"
filename="$datadir/th"
# make sure hsign is uppercase
hsign="`echo $hsign|tr '[a-z]' '[A-Z]'`"
cat $datadir/$hsign > $filename
echo -n "Today's date: " >> $filename
date +%D >> $filename
echo "Today's horoscope for:" >> $filename
lynx -width 1000 -dump "http://www.creators.com/lifestylefeatures/horoscopes/horoscopes-by-holiday.html" | grep $hsign | fold -sw $cw >> $filename
#output
# zenity --text-info --filename=$filename
cat $filename
#remove  unneeded file
rm $filename

gwhtml.sh
zip=$1
tmon=$(date +"%b")
tday=$(date +"%d")
echo "The weather for $zip on $tmon $tday:" >> tw
lynx -width 1000 -dump "http://m.wund.com/cgi-bin/findweather/getForecast?brand=mobile&query=$zip" > weather
cat weather | grep "Updated" > tw
cat weather | grep "Observed" >> tw
cat weather | grep "Temperature" >> tw
cat weather | grep "Humidity" >> tw
cat weather | grep " Dew Point" >> tw
cat weather | grep "Wind" | head -1 >> tw
cat weather | grep "Wind Gust" | head -1 >> tw
cat weather | grep "Pressure"  >> tw
cat weather | grep "Conditions" | head -1 >> tw
cat weather | grep "Visibility" >> tw
cat weather | grep "UV"  >> tw
cat weather | grep "Clouds" >> tw
cat weather | grep "Yesterday's Maximum" >> tw
cat weather | grep " Yesterday's Minimum" >> tw
cat weather | grep "Sunrise" >> tw
cat weather | grep "Sunset" >> tw
cat weather | grep "Moon Rise" >> tw
cat weather | grep "Moon Set" >> tw >> tw
cat weather | grep -A1 "Moon Phase" >> tw
cat weather | grep "Raw METAR" >> tw


Comments

Popular posts from this blog

Guiless?

Web.com and Network Solutions, the Walmart of the internet.

MSOffice vs Libreoffice