ps -ef | grep procedure_name | grep -v grep | awk '{print $2}' | xargs kill -9
#!/bin/sh #根據進程名殺死進程 if [ $# -lt 1 ] then echo "缺乏參數:procedure_name" exit 1 fi PROCESS=`ps -ef|grep $1|grep -v grep|grep -v PPID|awk '{ print $2}'` for i in $PROCESS do echo "Kill the $1 process [ $i ]" kill -9 $i done