[Ubuntu-zh] 一个翻译脚本,用于终端的命令行
luoshupeng
luoshupeng在gmail.com
星期六 三月 24 01:30:55 UTC 2012
这个很强大啊
于 2012年03月23日 23:26, Hex Lee 写道:
> ts(){
>
> curl -s \
> "
> http://fanyi.youdao.com/translate?smartresult=dict&smartresult=rule&smartresult=ugc&sessionFrom=dict.top"
> \
> -d \
> "type=AUTO&
> i=$1&doctype=json&xmlVersion=1.4&keyfrom=fanyi.web&ue=UTF-8&typoResult=true&flag=false"
> \
> | sed -E -n 's/.*tgt":"([^"]+)".*/\1/p' ;
>
> return 0;
> }
>
> 设置如下:
> linux用户:
> 1.添加此脚本到~/.bashrc的末尾
> 2.source ~/.bashrc
> Mac osX用户:
>
> 1.添加此脚本到~/.bash_profile的末尾,没有就新建
> 2.source ~/.bash_profile
>
> 使用:
>
>
> Shell代码
> $ ts hello
> 你好
> $ ts "how are you?"
> 你好吗?
>
> 也可以翻译中文。
>
> 原文地址<http://hexlee.iteye.com/blog/1442506>
> -------------- 下一部分 --------------
> 一个HTML附件被移除...
> URL:<https://lists.ubuntu.com/archives/ubuntu-zh/attachments/20120323/b1654fba/attachment.html>
关于邮件列表 ubuntu-zh 的更多信息