批量杀掉linux系统某类进程的shell程序
时间:2009-08-19 来源:presidentccj
#!/bin/sh
#written by ccj copyleft@ccj
while getopts :s:h OPTION
do
case ${OPTION} in
s) STR=${OPTARG}
kill -9 `ps -ef |grep $STR |awk '{print $2}' `;;
h) echo "usage:./k -s string";;
esac
done
shift $(($OPTIND-1))
exit 0
使用方法,杀掉ps -ef|grep opt的所有进程 ./k -s opt
#written by ccj copyleft@ccj
while getopts :s:h OPTION
do
case ${OPTION} in
s) STR=${OPTARG}
kill -9 `ps -ef |grep $STR |awk '{print $2}' `;;
h) echo "usage:./k -s string";;
esac
done
shift $(($OPTIND-1))
exit 0
使用方法,杀掉ps -ef|grep opt的所有进程 ./k -s opt
相关阅读 更多 +