Shell script to extract the exchange rates from BNR (Romania)

By | August 13, 2008

Here is a simple script to get the exchange rates from

#!/bin/bash
# clear the screen
clear
# display an info message
echo "+------------------------------+"
echo "|        BNR exchange          |"
echo "+------------------------------+"
# check for parameters
if [ $# -ne 1 ]
  then
    echo "Usage: $0 eur  or  $0 usd"
  else
    # convert parameter to upper case
    CURRENCY=$(echo $1 | tr '[:lower:]' '[:upper:]')
    # execute the extraction
    RON=$(lynx -source http://www.bnro.ro/nbrfxrates.xml | grep $CURRENCY | cut -c25-30)
   echo "1 $CURRNECY = $RON RON"
fi

More details about running a shell script on How to create a simple shell script and Understanding file permissions and ownership on Linux .

2 thoughts on “Shell script to extract the exchange rates from BNR (Romania)

  1. ado

    Salut, cum pot sa preiau cursul sub forma de mai jos intrun site joomla ?

    Stima

    var valuta_EUR = ‘4,2775’;var valuta_USD = ‘3,3212’;

  2. Mike

    Thanks for a wonderful post, l ve been looking for such information, I will join jour rss feed now.

Leave a Reply