Online dictionary from command-line
nazgee — pt., 04/22/2011 - 22:02
Some time ago my colleague showed me a script that allowed to use one of on-line translators from command line. Not only it looked geeky, but it also turned out to be pretty useful- accessing on-line dictionary without switching to Internet browser is not only faster, but also easier. They say, that necessity is the mother of invention- here is my English-Swedish dictionary in action:
online swedish-english dictionary accessed from commandline
Just to give you the idea how to create your own cutie like the one I have:
- find an online dictionary that embeds phrase to be translated in an a http address
- use wget to download appropriate page, and print it on stdout (try -O option)
- parse wget output usinggrep + sed + awk + whatever_you_wish to get the info you need, and display it in a fancy way
I probably should not be posting sources of this script, as it is ugly and uses brute force method. It will probably turn out useless when admin of site I am wget'ting will make some minor changes in it's translation engine. Hopefully it will work for some time :)
In the attached tarball beside the script itself you will also find two links: SVEENG and ENGSVE, each providing different direction of transtaltion. Just put a bash script and these two links together wherever you wish, create an alias to the two links, and you're done.
| Załącznik | Wielkość |
|---|---|
| dict.tar.gz = dict.sh + SVEENG + ENGSVE | 1.3 KB |
