[Ubuntu-zh] 一个翻译脚本,用于终端的命令行

2012-03-23 文章 Hex Lee
ts(){

curl -s \

http://fanyi.youdao.com/translate?smartresult=dictsmartresult=rulesmartresult=ugcsessionFrom=dict.top;
\
 -d \
type=AUTO
i=$1doctype=jsonxmlVersion=1.4keyfrom=fanyi.webue=UTF-8typoResult=trueflag=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 mailing list
ubuntu-zh@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-zh


Re: [Ubuntu-zh] 一个翻译脚本,用于终端的命令行

2012-03-23 文章 luoshupeng

这个很强大啊
于 2012年03月23日 23:26, Hex Lee 写道:

ts(){

curl -s \
 
http://fanyi.youdao.com/translate?smartresult=dictsmartresult=rulesmartresult=ugcsessionFrom=dict.top;
\
  -d \
type=AUTO
i=$1doctype=jsonxmlVersion=1.4keyfrom=fanyi.webue=UTF-8typoResult=trueflag=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 mailing list
ubuntu-zh@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-zh


Re: [Ubuntu-zh] 一个翻译脚本,用于终端的命令行

2012-03-23 文章 hooxin firefoxmmx
支持.

在 2012年3月24日 上午9:30,luoshupeng luoshup...@gmail.com写道:

 这个很强大啊
 于 2012年03月23日 23:26, Hex Lee 写道:

  ts(){

 curl -s \
 
 http://fanyi.youdao.com/**translate?smartresult=dict**
 smartresult=rulesmartresult=**ugcsessionFrom=dict.tophttp://fanyi.youdao.com/translate?smartresult=dictsmartresult=rulesmartresult=ugcsessionFrom=dict.top
 
 \
  -d \
 type=AUTO
 i=$1doctype=jsonxmlVersion=**1.4keyfrom=fanyi.webue=UTF-**
 8typoResult=trueflag=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/1442506http://hexlee.iteye.com/blog/1442506
 
 -- 下一部分 --
 一个HTML附件被移除...
 URL:https://lists.ubuntu.com/**archives/ubuntu-zh/**
 attachments/20120323/b1654fba/**attachment.htmlhttps://lists.ubuntu.com/archives/ubuntu-zh/attachments/20120323/b1654fba/attachment.html
 



 --
 ubuntu-zh mailing list
 ubuntu-zh@lists.ubuntu.com
 https://lists.ubuntu.com/**mailman/listinfo/ubuntu-zhhttps://lists.ubuntu.com/mailman/listinfo/ubuntu-zh

-- 下一部分 --
一个HTML附件被移除...
URL: 
https://lists.ubuntu.com/archives/ubuntu-zh/attachments/20120324/9533290f/attachment.html
-- 
ubuntu-zh mailing list
ubuntu-zh@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-zh