下载地址http://sourceforge.net/projects/yodao-free/files/python-dict/
之 后是解压 unzip pyton-dict.1.0.1.zip 生成pyton-dict.1.0.1文件夹,在里面有一个dict.py此时在pyton-dict.1.0.1文件夹里用 python dict.py +英文单词就可以查词了,不过我们需要随时随地的能够用命令查词,所以这肯定不行了。接下来就是
用shell打造一下。
sudo cp dict.py /usr/bin
sudo vim youdao(vim是功能强大的类似vi的编辑器)
内容如下:
#! /bin/bash
echo -n "input word>>"
while read -u0 in
do
python /usr/bin/dict.py ${in}
echo -n "input word>>"
done;
需要将dict.py和youdao(bash)这两个文件都放在/usr/bin文件夹中
最后如果提示“bash: /usr/bin/youdao: Permission denied“错误是因为权限不够,采用如下命令解决
sudo chmod 777 /usr/bin/youdao
这个时候输入youdao命令就可以用了
如下:
$ youdao
input word>>love
love
Translations from 有道词典
n. 恋爱;亲爱的;酷爱;喜爱的事物
vt. 喜欢;热爱;爱慕
vi. 爱
Translations from WordNet
a strong positive emotion of regard and affection
any object of warm affection or devotion
a beloved person; used as terms of endearment
a deep feeling of sexual desire and attraction
a score of zero in tennis or squash
Translations from yodao:
love: 爱情
First Love: 初恋
input word>>
转载于:https://www.cnblogs.com/jiyouyuan/articles/2680673.html