tonybaldwin | blog

non compos mentis

search wiktionary from the bash cli

with 2 comments

Last week I posted several scripts for searching google, google translate, google dictionary, reverso, and wikipedia from the bash command line.

Today I wrote another script, this time for searching wiktionary.org, the multilingual, user-edit online dictionary:

#!/bin/bash

# get definitions from wikitionary

if [ ! $1 ];
	then
read -p "Enter 2 letter language code: " lang
read -p "Enter search term: " sterm
lynx -dump $lang.wiktionary.org/wiki/$sterm | less
else
lynx -dump $1.wiktionary.org/wiki/$2 | less
fi

I tucked this into my PATH as simply “wikt”, and usage is thus:
you@machine:~$ wikt en cows
or, if you neglect to use the language code and search term, of course, the script asks for them:
you@machine:~$ wikt
Enter 2 letter language code: en
Enter search term: cows

Enjoy!

./tony

Advertisements

Written by tonybaldwin

May 16, 2011 at 7:11 am

2 Responses

Subscribe to comments with RSS.

  1. Hi Tony,
    How do I do to use it? I have no idea where to begin. Should I be a programmer to use it?
    Regards,
    Leo

    Leo Medina

    May 18, 2011 at 12:06 pm

  2. Não é necessário ser programador para utilizar isso, não.
    Mas, Leo, é somente para linux, e ainda assim, se você não sabe como executar um script, esse provavelmente não será útil para você, e seria melhor você simplesmente utilizar o interface de wiktionary no seu navegador.
    E se você estiver utilizando o ruindows, esse script não funcionará no seu sistema.

    tonybaldwin

    May 18, 2011 at 7:06 pm


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: