今早在 ubuntu-cn 的 irc 上忽闻 feisty 的 wiki快速指南正在进行中。发现 Stardict 词典安装新手可能有些麻烦,周末闲来无事,特写此脚本。自己测试过一两种情况,当然了,您若是情况比较特殊,还望告之,不胜感谢!
注:
1、通用词典文件有:21 世纪双向,朗道,韦氏,牛津,朗文,计算机专业;可自行添加。
2、词典文件来自 Ubuntu 中国之 ftp。
3、脚本文件见附件,高手可斧正。再谢!
#! /bin/bash
# install stardict
if [[ -f $(which stardict) ]]
then
echo ""
echo "You have stardict installed."
echo ""
echo "Downloading dictionary files ... "
echo ""
sleep 3
else
sudo apt-get install stardict -y
echo "Now stardict has been installed."
echo ""
echo "Downloading dictionary files ... "
echo ""
sleep 3
fi
# Definations
passwd="ubuntu:ubuntuftp"
url="http://$passwd@ftp.ubuntu.org.cn/stardict.sourceforge.net"
dir="$HOME/.stardict/dic"
# 通用词典选有:21世纪双向,朗道,韦氏,牛津,朗文,计算机专业
dict_1="stardict-21shijishuangxiangcidian-2.4.2.tar.bz2"
dict_2="stardict-langdao-ce-gb-2.4.2.tar.bz2"
dict_3="stardict-langdao-ec-gb-2.4.2.tar.bz2"
dict_4="stardict-merrianwebster-2.4.2.tar.bz2"
dict_5="stardict-oxford-gb-2.4.2.tar.bz2"
dict_6="stardict-longman-2.4.2.tar.bz2"
dict_7="stardict-computer-2.4.2.tar.bz2"
if [ ! -d $dir ]
then
mkdir -p $dir
fi
for dict in $dict_1 $dict_2 $dict_3 $dict_4 $dict_5 $dict_6 $dict_7
do
wget -c $url/$dict -P $HOME && tar jxf $HOME/$dict -C $dir
rm -rf $HOME/$dict
echo ""
done
echo "Run 'stardict &' in terminal,enjoy it."
echo ""
# install stardict
if [[ -f $(which stardict) ]]
then
echo ""
echo "You have stardict installed."
echo ""
echo "Downloading dictionary files ... "
echo ""
sleep 3
else
sudo apt-get install stardict -y
echo "Now stardict has been installed."
echo ""
echo "Downloading dictionary files ... "
echo ""
sleep 3
fi
# Definations
passwd="ubuntu:ubuntuftp"
url="http://$passwd@ftp.ubuntu.org.cn/stardict.sourceforge.net"
dir="$HOME/.stardict/dic"
# 通用词典选有:21世纪双向,朗道,韦氏,牛津,朗文,计算机专业
dict_1="stardict-21shijishuangxiangcidian-2.4.2.tar.bz2"
dict_2="stardict-langdao-ce-gb-2.4.2.tar.bz2"
dict_3="stardict-langdao-ec-gb-2.4.2.tar.bz2"
dict_4="stardict-merrianwebster-2.4.2.tar.bz2"
dict_5="stardict-oxford-gb-2.4.2.tar.bz2"
dict_6="stardict-longman-2.4.2.tar.bz2"
dict_7="stardict-computer-2.4.2.tar.bz2"
if [ ! -d $dir ]
then
mkdir -p $dir
fi
for dict in $dict_1 $dict_2 $dict_3 $dict_4 $dict_5 $dict_6 $dict_7
do
wget -c $url/$dict -P $HOME && tar jxf $HOME/$dict -C $dir
rm -rf $HOME/$dict
echo ""
done
echo "Run 'stardict &' in terminal,enjoy it."
echo ""