linux杀掉进程脚本

i=$(ps -ef|grep 'telnet localhost 18001'|grep -v 'grep'|wc -l)


if [ $i -ge 1 ]
then
         echo "管理进程已经存在,是否关闭原进程(Y/N)"
            read     isKill
            if [ $isKill = "Y" ]
                then
            ps -ef|grep 'telnet localhost 18001'|grep -v 'grep'|awk   -F" " '{print   $2}'|while read line
                do
                kill ${line}
            done     
      else
              exit 1
      fi
fi

posted @ 2016-06-16 10:53  W&L  阅读(624)  评论(0)    收藏  举报