查找进程ID语句:ps -ef | grep "$NAME" | grep -v "grep" | awk '{print $2}'
脚本内容:
#!/bin/sh NAME=$1
echo $NAME
ID=`ps -ef | grep "$NAME" | grep -v "grep" | awk '{print $2}'`
echo $ID
echo "---------------" for id in $ID do kill -9 $id echo "killed $id" done echo "---------------"?