Email or username:

Password:

Forgot your password?
Top-level
Malinux

@edsu
The output doesn't look like it's meant for humans, so I always pipe it into a markdown reader.

wotsa ()
{
def="$(curl -s dict://dict.org/define:$1: | grep -vP '^\d\d\d ')";
if [ "$def" = "" ]; then
echo no definition;
else
echo "$def" | mdcat -p;
fi
}

Abderian \Abde"rian, a. [From Abdera,
a town in Thrace, of which place
Democritus, the Laughing Philosopher,
was a native.] Given to laughter;
inclined to foolish or incessant
merriment. [1913 Webster] .
8 comments
Ed Summers

@malin I like it! And I didn't know about mdcat -- now I'm doing the same.

I dropped the -P for the grep since that's not available on MacOS with installing GNU grep. It still seems to work ok?

Malinux

@edsu The '-P' is for perl-like regex, so I can remove (-v) lines starting with (^) three digits (\d\d\d).

But there are loads of other ways of doing the same thing.

🚲

@malin @edsu or, you could install dictd which comes with a client, and you can also host all the dictionaries available on dict.org locally :D

Brett Stauffer

@malin @edsu
On definitions with indented content I was getting formatting garbage displayed with mdcat, so I tried bat ( github.com/sharkdp/bat/ ) with plain style instead and got much better results:

~/home/ [0] % bat bin/dict
File: bin/dict
/usr/bin/zsh
echo def="$(curl -s dict://dict.org/define:$1: | grep -vP '“\d\d\d')";
 if [ "$def" = "" ;
then 
echo No definition;
 else
 echo "$def" | bat --style plain;
 fi ~/home/ 
[0] % dict dictionary

 Dictionary \Dic"tion*a*ry\, n.; pl. {Dictionaries}. [Cf. F. dictionnaire. See {Diction}.]

1. A book containing the words of a language, arranged alphabetically, with explanations of their meanings; a lexicon; a vocabulary; a wordbook.

[1913 Webster] I applied myself to the perusal of our writers; and noting whatever might be of use to ascertain or illustrate any word or phrase, accumulated in time the materials of a dictionary. —-Johnson. [1913 Webster]

2. Hence, a book containing the words belonging to any system or province of knowledge, arranged alphabetically; as, a dictionary of medicine or of botany; a biographical dictionary.

[1913 Webster] ~/home/ [0] & _
Go Up