Skip to content

Instantly share code, notes, and snippets.

@sputnikus
Created July 20, 2011 15:23
Show Gist options
  • Save sputnikus/1095164 to your computer and use it in GitHub Desktop.
Save sputnikus/1095164 to your computer and use it in GitHub Desktop.
Google Translate command line
#!/bin/bash
if [ $# == 3 ]; then
echo "From: $1 To: $2"
lynx -dump "http://ajax.googleapis.com/ajax/services/language/translate?v=1.0&q=$3&langpair=$1|$2"|awk -F'"' '{print $6}'
else
lynx -dump "http://ajax.googleapis.com/ajax/services/language/translate?v=1.0&q=$1&langpair=|cs"|awk -F'"' '{print "From: "$10" To: cs \n"$6}';echo
lynx -dump "http://ajax.googleapis.com/ajax/services/language/translate?v=1.0&q=$1&langpair=|en"|awk -F'"' '{print "From: "$10" To: en \n"$6}';echo
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment