DaemonForums  

Go Back   DaemonForums > FreeBSD > FreeBSD General

FreeBSD General Other questions regarding FreeBSD which do not fit in any of the categories below.

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1   (View Single Post)  
Old 20th October 2008
neurosis neurosis is offline
Fdisk Soldier
 
Join Date: Jul 2008
Posts: 69
Default torsmo displaying weather question

Ive been reading on other forums "gentoo and ubuntu" that you can get torsmo to display the current weather. It looks rather simple though I dont know anything about programming or shell scripting. Here is a link to the thread.

http://forums.gentoo.org/viewtopic-t...rsmo+tips.html

Here is the code for the script.

Code:
#!/bin/bash
city="DeWitt"
link=USMI0231.html
file=/tmp/weather.txt
location=http://weather.yahoo.com/forecast/$link

lynx -accept_all_cookies -dump $location > $file
begin=`cat -n $file | grep "Currently" | cut -d ' ' -f5`
end=`expr $begin + 40`

head -n $end $file > tmp.t
tail -n 41 tmp.t > $file

case $1 in
   Today)  head -n 6 $file | sed '3d' ;;
   Tomorrow)
      begin=`cat -n $file | grep 'Today Tomorrow' | cut -d ' ' -f5`
      end=`cat -n $file | grep 'Extended' | cut -d ' ' -f5`
      num=`expr $end - $begin - 1`
      end2=`expr $begin + 7`

      head -n $end2 $file > tmp.t
      tail -n 3 tmp.t | sed 's/sky/\n sky/' | sed '4d' ;;
   *) exit ;;
esac

rm tmp.t
rm $file
When I run this I get an error.

Code:
$ ./tweather.sh
expr: syntax error
head: illegal line count -- /tmp/weather.txt
Can anyone offer suggestions as to why this isnt working?
Reply With Quote
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
external drive partition question + fdisk question gosha OpenBSD General 15 15th June 2009 02:00 PM


All times are GMT. The time now is 04:47 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick