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

August 13, 2008 – 19:59

Here is a simple script to get the exchange rates from www.bnro.ro/nbrfxrates.xml

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/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 .

Share and Enjoy:
  • Digg
  • del.icio.us
  • Reddit
  • Facebook
  • BlinkList
  • Fark
  • Simpy
  • Slashdot
  • StumbleUpon
  • Technorati
  • LinkedIn
  • Mixx
  • MySpace
  • Google Bookmarks
  • Live
  • Yahoo! Buzz
  • DZone
  • Twitter
  • Yahoo! Bookmarks

Tags: , ,

  1. One Response to “Shell script to extract the exchange rates from BNR (Romania)”

  2. 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′;

    By ado on Feb 2, 2009

Post a Comment