代码: 全选
#!/bin/bash
#这是一个添加字体和更改firefox 的flash乱码的脚本
#按任意键继续的函数
get_char()
{
SAVEDSTTY=`stty -g`
stty -echo
stty raw
dd if=/dev/tty bs=1 count=1 2> /dev/null
stty -raw
stty echo
stty $SAVEDSTTY
}
echo "#################################################################"
echo "这是一个添加字体和更改firefox的flash乱码的脚本,由于要使用超级管理员权限,所"
echo "使用这个脚本请使用 sudo ./ 防止由于权限问题出现的错误!"
echo "#################################################################"
#整体的循环
while [ 1 ]
do
echo "请选择要使用的功能:1.添加字体 2.修复火狐flash乱码 3.退出"
read -p "请输入:" ct
if [ $ct -eq 1 ] ; then
#添加字体
echo "请事先把字体文件放到/tmp/ttf下如果没有这个目录创建这个目录"
echo "按任意件继续:"
char=`get_char`
mkdir /usr/share/fonts/ttf
cp /tmp/ttf/* /usr/share/fonts/ttf
cd /usr/share/fonts/ttf
chmod 744 *
mkfontscale
mkfontdir
fc-cache -f -v
elif [ $ct -eq 2 ] ; then
#修改乱码
cp /etc/fonts/conf.d/49-sansserif.conf /etc/fonts/conf.d/49-sansserif.conf.bak
rm /etc/fonts/conf.d/49-sansserif.conf
elif [ $ct -eq 3 ] ; then
#退出
echo "###################################谢谢你的使用!!!!!!!#########"
echo "按任意键盘退出"
char=`get_char`
exit 0
else
echo "对不起你输入的选项错误"
fi
done