31
install_shell/set_fcitx.sh
Executable file
31
install_shell/set_fcitx.sh
Executable file
@@ -0,0 +1,31 @@
|
||||
#!/bin/bash
|
||||
|
||||
IM_CONFIG=/usr/share/config/kdm/Xsession
|
||||
|
||||
grep "LC_CTYPE" /etc/csh.cshrc
|
||||
if [ $? -ne 0 ];then
|
||||
echo "setenv LC_CTYPE zh_CN.gb18030">>/etc/csh.cshrc
|
||||
fi
|
||||
|
||||
if [ "$1" = "scim" ];then
|
||||
imethod=fcitx
|
||||
elif [ "$1" = "fcitx" ];then
|
||||
imethod=scim
|
||||
else
|
||||
echo "Usage:[fcitx | scim]"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
line1=$(grep -n $1 $IM_CONFIG | tail -n 1 | cut -d: -f1)
|
||||
line2=$(grep -n ${imethod} $IM_CONFIG | tail -n 1 | cut -d: -f1)
|
||||
|
||||
grep $1 $IM_CONFIG | tail -n 1 | grep '#' &> /dev/null
|
||||
if [ $? -eq 0 ];then
|
||||
sed -i "${line1}s@#@@" $IM_CONFIG
|
||||
sed -i "${line2}s@^@#&@" $IM_CONFIG
|
||||
echo "$1 change successful."
|
||||
else
|
||||
echo "$1 already."
|
||||
exit 0
|
||||
fi
|
||||
Reference in New Issue
Block a user