View Single Post
  #7   (View Single Post)  
Old 20th October 2008
J65nko J65nko is offline
Administrator
 
Join Date: May 2008
Location: Budel - the Netherlands
Posts: 4,131
Default

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
The lines not prefixed with a '+' are the source. The '+' lines show the result..
Code:
begin=`cat -n $file | grep "Currently" | cut -d ' ' -f5`
+ + grep Currently
cat -n /tmp/weather.txt
+ cut -d   -f5
+ begin=
Here you see that the variable 'begin' has no value.

Code:
end=`expr $begin + 40`
+ expr + 40
expr: syntax error
+ end=
Because 'begin' is empty, the expr command fails and also leaves the variable 'end' empty.
Code:
head -n $end $file > tmp.t
+ head -n /tmp/weather.txt
Here the '+' lines shows that 'end' is empty, so no line count is passed to the head utility.
Code:
head: illegal line count -- /tmp/weather.txt
Not that difficult isn't it?
__________________
You don't need to be a genius to debug a pf.conf firewall ruleset, you just need the guts to run tcpdump
Reply With Quote