new-words

view misc/de-shell @ 67:87bb1c5e6616

added de script to misc/
author Igor Chubin <igor@chub.in>
date Wed Mar 28 15:54:30 2012 +0200 (2012-03-28)
parents
children
line source
2 make_wordlist()
3 {
4 cp -R stardict-GR-LingvoUniversal-2.4.2 /tmp/
5 cd /tmp/stardict-GR-LingvoUniversal-2.4.2/
6 mv GR-Universal.dict.dz GR-Universal.dict.gz
7 gunzip GR-Universal.dict.gz
8 /usr/lib/stardict-tools/stardict2txt GR-Universal.ifo ~/Langs/Deutsch/GR-Universal.txt
9 cat ~/Langs/Deutsch/GR-Universal.txt | expand| sed 's/ *<.*//; s/ *$//' > ~/Langs/Deutsch/word-list.txt
10 }
12 if [ "$1" = init ]
13 then
14 cd /usr/share/stardict/dic/
15 make_wordlist
16 exit 0
17 fi
19 TEMP=`mktemp /tmp/nw-shell-XXXXXX`
20 WORD_LIST=~/Langs/Deutsch/word-list.txt
21 rlwrap -f ${WORD_LIST} sh -c '
22 while true;
23 do
24 printf "\033[01;33m > " ;
25 read word options || { exit; printf "\033[00m" ; } ;
26 if [ "$word" = grep ]
27 then
28 grep "$options" "'"${WORD_LIST}"'"
29 elif [ "$word" = vf ]
30 then
31 verbformen "$options"
32 elif [ "$word" = "#" ]
33 then
34 printf "\033[00mWelcome to session >>"$options"<<\n" ;
35 echo $word $options >> ~/Langs/Deutsch/de-shell.log
36 else
37 printf "\033[00m" ;
38 echo $word >> ~/Langs/Deutsch/de-shell.log
39 de $word;
40 fi
41 done'
42 rm $TEMP