Most of the time while buying online I have to convert USD to INR. By using following script you can do the task by simply entering the amount in USD. You must need lynx command and Internet connection cause it fetches currency rate from net.

To install lynx via yum

yum install lynx

To install lynx via apt-get

apt-get install lynx

Copy & save following as in your home folder

# A shell script to to convert USD to INR
# ----------------------------------------------------------------------------
# Written by Vidyadhar 
# Contact;
# ----------------------------------------------------------------------------
lynx -dump "" > /tmp/net
NET=`cat /tmp/net | grep -m 1 "TechieNote" | cut -d "]" -f 2 | cut -d " " -f 1`
if [ "$NET" = "$TEXT" ]; then
        echo "You are connected to the Net"
        echo "Please check your net connection and run the script again"
echo "Insert the USD you want to convert in INR"
read CONV
lynx -dump "$CONV&from=USD&to=INR" > /tmp/conv
cat /tmp/conv | grep Convert | sed 's/Convert//g' | sed 's/^[ \t]*//;s/[ \t]*$//'
rm -rf /tmp/net
rm -rf /tmp/conv

How Do I Use This Script?
Just run

sh ~/
Shell Script to Convert USD to INR
Tagged on:                                                                                     

Leave a Reply

Your email address will not be published. Required fields are marked *