new-words

diff misc/de-shell @ 66:53ba2847501f

added misc scripts
author Igor Chubin <igor@chub.in>
date Tue Mar 27 14:16:46 2012 +0200 (2012-03-27)
parents
children
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/misc/de-shell	Tue Mar 27 14:16:46 2012 +0200
     1.3 @@ -0,0 +1,42 @@
     1.4 +
     1.5 +make_wordlist()
     1.6 +{
     1.7 +    cp -R stardict-GR-LingvoUniversal-2.4.2 /tmp/
     1.8 +    cd /tmp/stardict-GR-LingvoUniversal-2.4.2/
     1.9 +    mv GR-Universal.dict.dz GR-Universal.dict.gz
    1.10 +    gunzip GR-Universal.dict.gz
    1.11 +    /usr/lib/stardict-tools/stardict2txt GR-Universal.ifo ~/Langs/Deutsch/GR-Universal.txt
    1.12 +    cat ~/Langs/Deutsch/GR-Universal.txt | expand| sed 's/ *<.*//; s/ *$//' > ~/Langs/Deutsch/word-list.txt
    1.13 +}
    1.14 +
    1.15 +if [ "$1" = init ]
    1.16 +then
    1.17 +    cd /usr/share/stardict/dic/
    1.18 +    make_wordlist
    1.19 +    exit 0
    1.20 +fi
    1.21 +
    1.22 +TEMP=`mktemp /tmp/nw-shell-XXXXXX`
    1.23 +WORD_LIST=~/Langs/Deutsch/word-list.txt
    1.24 +rlwrap -f ${WORD_LIST} sh -c '
    1.25 +    while true; 
    1.26 +    do 
    1.27 +        printf "\033[01;33m > " ;
    1.28 +        read word options || { exit; printf "\033[00m" ; } ;
    1.29 +        if [ "$word" = grep ]
    1.30 +        then
    1.31 +            grep "$options" "'"${WORD_LIST}"'"
    1.32 +        elif [ "$word" = vf ]
    1.33 +        then
    1.34 +            verbformen "$options"
    1.35 +        elif [ "$word" = "#" ]
    1.36 +        then
    1.37 +            printf "\033[00mWelcome to session >>"$options"<<\n"  ;
    1.38 +            echo $word $options >> ~/Langs/Deutsch/de-shell.log
    1.39 +        else
    1.40 +            printf "\033[00m" ;
    1.41 +            echo $word >> ~/Langs/Deutsch/de-shell.log
    1.42 +            de $word; 
    1.43 +        fi
    1.44 +    done'
    1.45 +rm $TEMP