CLI search tools

search dict.org from bash terminal, cli

Tony's Wiki | bash

I wrote these scripts for quick-n-dirty search for terminology, word definitions, etc. while working on my translation work.
If you're looking for a graphical dictionary look-up program, try tdict, a tcl/tk gui dict.org look-up program I wrote.

dict.org dictionary

#!/bin/bash
 
# default db=all
 
if [[ $(echo $*) ]]; then
 
    searchterm="$*"
else
 
    read -p "Enter your search term: " searchterm
fi
read -p "CHOOSE SOURCE
(enter 'list' to list all options, 
leave blank for first match, 
or enter all for all possible matches)
: " db
 
if [[ $db = list ]] ; then
curl dict://dict.org/show:db
 
read -p "choose database, again: " db
fi
 
curl dict://dict.org/d:$searchterm:$db | less

Or, say you just want the thesaurus:

#!/bin/bash
 
# moby-bash
# copyright tony baldwin, baldwinsoftware.com
 
if [[ $(echo $*) ]]; then
 
    searchterm="$*"
else
 
    read -p "Enter your search term: " searchterm
fi
 
curl dict://dict.org/d:$searchterm:moby-thes

reverso

#!/bin/bash
 
#search reverso
 
if [ ! $1 ]; 
	then
read -p "Enter the source language: " slang
read -p "Enter target language: " tlang
read -p "Enter your search term: " searchterm
lynx -dump --accept-all-cookies dictionary.reverso.net/$slang-$tlang/$searchterm | less
 
else 
 
lynx -dump --accept-all-cookies dictionary.reverso.net/$1-$2/$3 | less
 
fi

bab.la

#!/bin/bash
 
# search bab.la dictionary
 
 
if [ ! $1 ]; 
	then
read -p "Enter the source language: " slang
read -p "Enter target language: " tlang
read -p "Enter your search term: " sterm
lynx -dump --accept-all-cookies en.bab.la/dictionary/$slang-$tlang/$sterm | less
 
else
lynx -dump --accept-all-cookies en.bab.la/dictionary/$1-$2/$3 | less
 
fi

wiktionary

#!/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

duck duck go

#!/bin/bash
 
# search duckduckgo.com
if [ ! $* ]; then
	read -p "Please enter a search term: " sterm
else
	sterm=$*
fi
	st=${sterm// /+}
	lynx --accept-all-cookies http://duckduckgo.com/?q=$st
# These programs are free software; you can redistribute them and/or modify 
# them under the terms of the GNU General Public License as published by 
# the Free Software Foundation; either version 2 of the License, or 
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

tonybaldwin 2012.01.03.22.03


~~DISQUS~~