Skip to content

Instantly share code, notes, and snippets.

@dayer4b
Last active August 29, 2015 14:14
Show Gist options
  • Save dayer4b/bf21e75d48272a4e7b42 to your computer and use it in GitHub Desktop.
Save dayer4b/bf21e75d48272a4e7b42 to your computer and use it in GitHub Desktop.
use sdcv to create a simple `define word` function for bash in Ubuntu 14.04 -- lifted and modified from: http://askubuntu.com/questions/191125/is-there-an-offline-command-line-dictionary
# install sdcv
sudo apt-get install sdcv
# make a dictionary folder
sudo mkdir -p /usr/share/stardict/dic
# download some dictionaries (check askubuntu link for better list of available dictionaries,
# but keep in mind that you will get multiple definitions with multiple dictionaries)
wget http://abloz.com/huzheng/stardict-dic/dict.org/stardict-dictd_www.dict.org_gcide-2.4.2.tar.bz2
# untar it into the dictionary folder
sudo tar xf stardict-dictd_www.dict.org_gcide-2.4.2.tar.bz2 -C /usr/share/stardict/dic
# NOTE: the wget + untarring can probably done more simply with curl
# at this point you can use `sdcv hello` to define a word, but I find it slightly less readable than I'd prefer.
# so...
echo 'function define() { sdcv "$@" | less ;}' >> ~/.bashrc
# that bash function makes the command "define" and pipes the output to less, much nicer :)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment