#!/bin/sh process="simCardCharge" ps -ef |grep "${process}" | grep -v grep pro_count=`ps -ef |grep "${process}" |grep -v grep | grep -v sh|wc -l` for i in `seq $pro_count` do SEARCH_PID=`ps -ef |grep "${process}" | grep -v grep |grep -v sh| sed -n '1p'|awk '{print $2}'` if [ $SEARCH_PID -ne 0 ]; then echo "kill pid "$SEARCH_PID kill -9 $SEARCH_PID fi done ./status.sh