Skip to content

Instantly share code, notes, and snippets.

@vayn
Created March 28, 2011 11:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vayn/890293 to your computer and use it in GitHub Desktop.
Save vayn/890293 to your computer and use it in GitHub Desktop.
命令行字典外加保存到在线生词本
# .bashrc
function vasa {
if [ ! "$*" ]; then
echo 'Oops, I need food!'
return 1
fi
gougou $*
echo "$* #vasa" | bti
}
#!/bin/bash
# Command line Google dictionary
echo "----------------------------"
curl --output /tmp/gdict.tmp -s -A 'Mozilla/4.0' 'http://www.google.com.hk/dictionary?aq=f&langpair=en|zh-CN&q='$1'&hl=en'
cat /tmp/gdict.tmp | html2text -utf8 -nobs -style compact -width 1000 | sed -n -e '/^ /p'| sed '1,4d' | head -n -1
#EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment