terminal dictionary
List the definition of a random word from a vocabulary file on terminal startup.
1. First install terminal dictionary (sdcv):
$ sudo apt-get install sdcv
2. Download dictionary files of choice from:
http://abloz.com/huzheng/stardict-dic/dict.org/
3. Install dictionary:
sudo mkdir -p /usr/share/stardict/dic/ sudo tar -xvjf dictionary.tar.bz2 -C /usr/share/stardict/dic
4. Create a script to read random word from vocabulary file (vocab.txt, vocabularies are line separated) and pass to sdcv:
vocab.sh
#!/bin/bash vocabFile=~/Documents/vocab.txt if [ ! -f $vocabFile ]; then echo "vocabulary file not found!" exit fi lineCount=$(more $vocabFile | wc -l) rand="$((($RANDOM % lineCount) + 1))p" vocab=$(sed -n $rand $vocabFile) sdcv $vocab
5. execute script of terminal startup:
$ echo vocab.sh >> ~/.bashrc
Comments Off