BASH script to get the exchange rate of two currencies
Code:
#!/bin/bash
#by GrouchyGaijin
# I called this script exrate.
echo "This script is for getting the current exchange rate "
read -p "Enter the symbol of the currency you want to convert from. Ex: SEK " var1
read -p "Enter the symbol of the currency you want to convert to. Ex: USD " var2
read -p "Enter the amount you want to convert: " var3
wget -q -O - "http://www.google.com/finance/converter?a=$var3&from=$var1&to=$var2"|grep "<div id=currency_converter_result>"|sed 's/<[^>]*>//g'
until false; do
echo "Press R to run the script again or Q to quit. "
read x
if [ "$x" = "R" ]; then
exrate
elif [ "$x" = "Q" ]; then
echo "Going down"
killall exrate
break
fi
done
Thank you,
GG -----------
Bookmarks