Your name here (please print):
Your student ID number here:
<B CLASS=obsTempTextA>65°F</B>
#!/bin/bash
wget "http://www.weather.com/weather/local/24060" -o /dev/null -O page
#!/bin/bash
if [ $# -eq 0 ]
then
echo "No arguments given."
exit 2
fi
wget "http://www.weather.com/weather/local/24060" -o /dev/null -O page
#!/bin/bash
if [ $# -eq 0 ]
then
echo "No arguments given."
exit 2
fi
# Take the zipcode, and see if it matches this regular expression.
# $? is the return code of the last command, which is the return
# of egrep, indicating if the zipcode matches our pattern
echo $1 | egrep "^[0-9]{5}$" >/dev/null
if [ "$?" -ne "0" ]; then
echo "$1 isn't a valid zip"
else
wget "http://www.weather.com/weather/local/24060" -o /dev/null -O page
fi
#!/bin/bash
if [ $# -eq 0 ]
then
echo "No arguments given."
exit 2
fi
for i
do
# Take the zipcode, and see if it matches this regular expression.
# $? is the return code of the last command, which is the return
# of egrep, indicating if the zipcode matches our pattern
echo $i | egrep "^[0-9]{5}$" >/dev/null
if [ "$?" -ne "0" ]; then
echo "$i isn't a valid zip"
else
wget "http://www.weather.com/weather/local/$i" -o /dev/null -O page
temperature=`grep temp= page | cut -d "&" -f 2 | cut -d = -f 2`
echo "Currently, it is $temperature degrees F in location $i"
fi
done
#!/bin/bash
if [ $# -eq 0 ]
then
echo "No arguments given."
exit 2
fi
for i
do
# Take the zipcode, and see if it matches this regular expression.
# $? is the return code of the last command, which is the return
# of egrep: "0" means everything worked that is egrep found a
match, i.e. zipcode matches our pattern
echo $i | egrep "^[0-9]{5}$" >/dev/null
if [ "$?" -ne "0" ]; then
echo "$i isn't a valid zip"
else
wget "http://www.weather.com/weather/local/$i" -o /dev/null -O page
temperature=`grep temp= page | cut -d "&" -f 2 | cut -d = -f 2`
location=`grep "<TITLE>" page | awk '{ print $5, $6 }'
echo "Currently, it is $temperature degrees F in $location"
fi
done