Converting currency over the command line

Sometimes it’s nice to be able to convert currency in a fast a simple way (especially if you’re really busy). There is a simple way to do so over your terminal that’s probably always open in front of you.

All you have to do is open up your .bashrc profile file and add the code below.

cconv() {
wget -qO- "http://www.google.com/finance/converter?a=$1&from=$2&to=$3" |  sed '/res/!d;s/<[^>]*>//g';
}

This creates an alias called cconv for your current terminal user where you can call to convert currency as the example below.

kaan@kaan-laptop:~_022

So you would type the below to convert 1 US Dollar to Turkish Lira’s.

cconv 1 usd try

About the author

kaandemircan

View all posts

Leave a Reply

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