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