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

Here is a simple script to get the exchange rates from

# clear the screen
# display an info message
echo "+------------------------------+"
echo "|        BNR exchange          |"
echo "+------------------------------+"
# check for parameters
if [ $# -ne 1 ]
    echo "Usage: $0 eur  or  $0 usd"
    # convert parameter to upper case
    CURRENCY=$(echo $1 | tr '[:lower:]' '[:upper:]')
    # execute the extraction
    RON=$(lynx -source | grep $CURRENCY | cut -c25-30)
   echo "1 $CURRNECY = $RON RON"

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

Published by Cristian Radulescu

PHP // MySql // Linux

Join the Conversation


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


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

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

Leave a comment

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.