View Single Post
  #3   (View Single Post)  
Old 20th October 2008
neurosis neurosis is offline
Fdisk Soldier
 
Join Date: Jul 2008
Posts: 69
Default

Quote:
Originally Posted by J65nko View Post
To see where the error is, run the script with debugging enabled
Code:
$ sh -vx ./tweather.sh
Code:
$ sh -vx ./tweather.sh
#!/usr/local/bin/bash
city="Ogden, UT"
+ city=Ogden, UT
link=USUT0020.html
+ link=USUT0020.html
file=/tmp/weather.txt
+ file=/tmp/weather.txt
location=http://weather.yahoo.com/forecast/$link
+ location=http://weather.yahoo.com/forecast/USUT0020.html

lynx -accept_all_cookies -dump $location > $file
+ lynx -accept_all_cookies -dump http://weather.yahoo.com/forecast/USUT0020.html
begin=`cat -n $file | grep "Currently" | cut -d ' ' -f5`
+ + grep Currently
cat -n /tmp/weather.txt
+ cut -d   -f5
+ begin=
end=`expr $begin + 40`
+ expr + 40
expr: syntax error
+ end=

head -n $end $file > tmp.t
+ head -n /tmp/weather.txt
head: illegal line count -- /tmp/weather.txt
tail -n 41 tmp.t > $file
+ tail -n 41 tmp.t

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
+ exit
I dont know what all of this means. I see an expression error?
Reply With Quote