Bash – a quick stock quote function
Wrote this and stuck it in my .bashrc file so I could get a realtime stock quote quickly from my shell sessions.
stock () { lynx -dump "http://www.google.com/finance?client=ob&q=${1}" | sed 's/.*']'//' | \ perl -00ne "print if /Watch this stock/i" | sed 's/Watch this stock//' | sed 's/Disclaimer//' | \ sed '/^$/d' | sed 's/Currency in USD//' } |
crouse@archie stock slv
slv
30.26
+0.08 (0.27%)
Real-time: 11:41AM EST1. Range 30.14 – 30.44
2. 52 week 14.37 – 30.44
3. Open 30.29
4. Vol / Avg. 9.57M/26.84M
5. Mkt cap 9.73B
6. P/E 95.32
7. Div/yield -
8. EPS 0.32
9. Shares 321.50M
10. Beta 0.38
11. Inst. own 25%
