January 2004
Intermediate to advanced
368 pages
7h 25m
English
A more complex task for the shell is to keep track of the overall value of your stock portfolio. While this might actually be too depressing to see each time you log in, the building blocks are quite informative and valuable on their own.
Like Script #66, this solution is built from two different scripts, one that extracts the most recently traded value of a given stock, and a second script that reads and calculates running totals for a portfolio of stocks.
#!/bin/sh # getstock - Given a stock ticker symbol, returns its current value # from the Lycos website. url="http://finance.lycos.com/qc/stocks/quotes.aspx?symbols=" if [ $# -ne 1 ] ; then echo "Usage: $(basename $0) stocksymbol" >&2 exit ...
Read now
Unlock full access