new-words

annotate misc/de-shell @ 68:846240941452

added -C key: compress to lines; fixed bug with #90-line
author Igor Chubin <igor@chub.in>
date Sun Sep 23 16:07:29 2012 +0300 (2012-09-23)
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