From fd80cd87661cfca752cecdb369ea2795b0871d8d Mon Sep 17 00:00:00 2001 From: Peng Zhihui Date: Thu, 13 Mar 2014 13:29:06 +0800 Subject: [PATCH] modified: install_shell/set_fcitx.sh --- install_shell/set_fcitx.sh | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/install_shell/set_fcitx.sh b/install_shell/set_fcitx.sh index 3d1203c..6c28fe0 100755 --- a/install_shell/set_fcitx.sh +++ b/install_shell/set_fcitx.sh @@ -1,9 +1,12 @@ #!/bin/bash +set -x -e + IM_CONFIG=/usr/share/config/kdm/Xsession -grep "LC_CTYPE" /etc/csh.cshrc -if [ $? -ne 0 ];then +#grep "LC_CTYPE" /etc/csh.cshrc +#if [ $? -ne 0 ];then +if grep -q -v "LC_CTYPE" /etc/csh.cshrc;then echo "setenv LC_CTYPE zh_CN.gb18030">>/etc/csh.cshrc fi @@ -20,8 +23,9 @@ 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 +#grep $1 $IM_CONFIG | tail -n 1 | grep '#' &> /dev/null +#if [ $? -eq 0 ];then +if grep "$1" "$IM_CONFIG" | tail -n 1 | grep '#';then sed -i "${line1}s@#@@" $IM_CONFIG sed -i "${line2}s@^@#&@" $IM_CONFIG echo "$1 change successful."