Solution to Lab 10 ------------------ #!/bin/bash if [ $# -eq 0 ] then echo "`basename $0`: too few arguments." echo "Usage: `basename $0` TICKERSYMBOL..." exit 1 fi # the search patterns below work only for stocks, not mutual funds # and other traded items prefix="http://finance.yahoo.com/q?s=" for i do url=$prefix$i wget $url -o /dev/null -O page val=`sed -n '/Last Trade/ { s/\(.*\)Last Trade\(.*\)<[bB]>\(.*\)<\/[bB]><\/big>\(.*\)/\3/ p }' page` name=`sed -n '/('$i')<\/b>/{ s/\(.*\)\(.*\) ('$i')<\/b>\(.*\)/\2/ p }' page` echo "The stock of" $name "("$i") is priced at $"$val"." done