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 | .....'

Download Translate Shell

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


  • use make

    sudo make install


  • 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"'
  • why do you use the -0 option ? – Abdul Al Hazred Mar 30 '15 at 17:30
  • what is the purpose of this >(......) structure ? – Abdul Al Hazred Mar 30 '15 at 17:32
  • xargs: unmatched single quote; by default quotes are special to xargs unless you use the -0 option – A.B. Mar 30 '15 at 17:35
  • tee is used to split the output of a program – A.B. Mar 30 '15 at 17:38
  • 1
    Sorry, I had tested it with zsh. Now it should work with bash. – A.B. Mar 30 '15 at 18:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.