Command line dictionary


The UNIX tips mailing list provides daily UNIX hints and tricks:

http://www.ugu.com/sui/ugu/show?tip.today

I received a tip a few months back that showed how to use lynx to lookup a word on dictionary.com, and decided to add this to my .profile:

dict () {
if [ "${1}" != "" ]
then
lynx -cfg=/dev/null -dump
"http://www.dictionary.com/cgi-bin/dict.pl?term=$1"
| more
else
echo "USAGE: dict word"
fi
}

This function accepts an argument, and passes the URL with the word to lookup to lynx. The function can be invoked by typing “dict” at a shell prompt:

$ dict manager

The one who ruins my life with their clueless ways

I had to throw that in :) Here is a real run:

$ dict orthogonal

[1]Dictionary.com _________________________
Search
(_) Dictionary (_) Thesaurus (_) Web
[2]Home Premium: [3]Sign up | [4]Login

or?thog?o?nal [5] Audio pronunciation of "orthogonal"
( P ) [6]Pronunciation Key (?r-th g -n l)
adj.
1. Relating to or composed of right angles.
2. Mathematics.
a. Of or relating to a matrix whose transpose equals its
inverse.
b. Of or relating to a linear transformation that preserves the
length of vectors.

[ ... ]

As you can see, this is rather useful (especially when you use vi to draft all of your documents).

This article was posted by Matty on 2005-01-15 00:06:00 -0400 -0400