Last active
January 30, 2016 22:00
-
-
Save chmouel/8e4b2be7795e17e7b338 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function mystock () { | |
local totalstock=NUMBEROFSTOCKYOUHAVE | |
local companystock=STOCKQUOTE | |
local yahoobase=http://download.finance.yahoo.com/d/quotes.csv?s | |
local yahooconv="${yahoobase}=USDEUR=X&f=l1" | |
local stockprice=$(curl -s "${yahoobase}=${companystock}&f=l1"|tr -d '^M') | |
local total=$[ $stockprice * $totalstock ] | |
local divided=$[ total / 4 ] | |
local eur=$(curl -s $yahooconv) | |
local eurtotal=$[ $total * $eur ] | |
local eurdivided=$[ $divided * $eur ] | |
printf "$fg[magenta]TOTAL$fg[default]: USD $fg[green]%d\$$fg[default]|EUR $fg[red]%d�~B�$fg[default] // DIV: USD $fg[green]%d\$$fg[default]|EUR $fg[red]%d�~B�$fg[default]\n" $total $eurtotal $divided $eurdivided | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment