#!/bin/sh
NAME=$1
echo $NAME
if [ ! $NAME ];then
echo "please input parameter"
return 1
fi
ID=`ps -ef | grep "$NAME" | grep -v "$0" | grep -v "grep" | awk '{print $2}'`
echo $ID
echo "------------------------"
for id in $ID
do
kill -9 $id
echo "killed $id"
done
echo "------------------"
========================================================================
if语句进行判断是否为空
[ "$name” = "" ]
等同于
-
[ ! "$name" ]
-
[ -z "$name" ]