#!/bin/sh
#add by hudong,2003-08-04
#kill process by program-name
if test $# -lt 1
then
echo "Usage:"$0" program-name"
exit 1
fi
var=`ps -ef|grep $1|grep -v grep |awk '{ printf "%s ", $2}'`
if [ -z "$var" ]
then
echo "$1 not started!"
exit 1
else
if kill -9 $var
then
echo "$1 is killed"
else
echo "$1 is not killed!Please check!"
exit 1
fi
fi
标签:grep,根据,杀掉,kill,echo,var,exit,进程,fi From: https://blog.51cto.com/u_2650279/6143057