0

I want to write a Script that picks a random English word from /usr/share/dict/words, translates it into German, display both of them for a certain amount of time and repeat the process. I only know the beginning part and do not know how to use a word to word translation in the shell:

watch -n5 sh -c 'cat /usr/share/dict/words | shuf -n1 | .....'
A.B.
  • 3,372
  • 2
  • 17
  • 27
Abdul Al Hazred
  • 25,760
  • 23
  • 64
  • 88

1 Answers1

1

Download Translate Shell

cd
wget https://github.com/soimort/google-translate-cli/archive/master.tar.gz
tar -xvf master.tar.gz
cd google-translate-cli-master/

Install

  • use make

    sudo make install
    

    OR

  • use checkinstall

    sudo apt-get install checkinstall
    sudo checkinstall
    

    If you see this: 3 - Version: [ master ]then

    • Press 3
    • Enter a number, e.g. 20150330
    • Press Return

Translate with

cat /usr/share/dict/words | shuf -n1 | tee >( xargs -0 trs {=de} | xargs echo) | xargs -0 echo -n

Your command

watch -n5 'bash -c "cat /usr/share/dict/words | shuf -n1 | tee >( xargs -0 trs {=de} | xargs echo) | xargs -0 echo -n"'
A.B.
  • 3,372
  • 2
  • 17
  • 27