|
Welcome to my blog!
删除指定进程名 |
#!/bin/bash #kill process HOLD1=tmp/hold1.$$ PORCESS=$1 usage(){ echo "Usage:`basename $0` process_name" exit 1 } if [ $# -ne 1 ];then usage fi case $1 in *) ps x|grep "$PORCESS"|grep -v "grep"|grep -v "$0"|awk '{print $1"\t"$5}' >$HOLD1 ;; esac if [ ! -s $HOLD1 ];then echo "No processes found ...sorry" exit 1 fi while read Loop1 Loop2 do echo $Loop1 $Loop2 done<$HOLD1 echo -n "Are these the processes to be killed..." read ANS case $ANS in Y|y)while read Loop do echo $Loop1 kill -9 $Loop1 done <$HOLD1 ;; n|N) echo "No selected kill process!" ;; esac rm -f $HOLD1 |
[ 阅读全文 | 回复(0) | 引用通告 | 编辑 ] |
Post by badboy 发表于 2006-12-16 16:43:00
|
|
| |