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?