Hello, today I'd like to show you a simple trick to have simple currency converter on Linux command line. I hope this post is useful for you especially for those who often works with international sales or trading. Here is a working example.
It uses Google Finance service to work, please make sure you are connected to the Internet when using it. Now, please open ".bashrc" file using your favorite text editor. If you use Gedit, simply type the following command to open it:
Create new line at the end of the file, and put this code:
- gedit ~/.bashrc
After editing, ".bashrc" file should looks like this:
- currency_convert() {
- curl -s "http://www.google.com/finance/converter?a=$1&from=$2&to=$3" | sed '/res/!d;s/<[^>]*>//g';
- }
Save the changes and close the text editor. Now, open Terminal and type the following command to apply the changes you've made:
Done! Now, you can use simple currency converter by typing:
- source ~/.bashrc
The above command convert 1 US Dollar into Euro. Please change the code to suit your needs.
- currency_convert 1 usd eur
Enjoy :)
0 comments:
Post a Comment