两个小脚本一个用于去注释一个用于列出或杀死匹配的程序

| 暂无评论 | 暂无引用通告

-->

  列出或杀死匹配的程序
#!/bin/sh
#name:lkp
#comment:list or kill processor
if [ $# = "2" ] && [ $2 = "l" -o $2 = "k" ] ; then
{
        if [ -z "$2" -o "$2" = "l" ]; then
                ps aux |grep "$1" |grep -v "grep"|grep -v "/bin/sh"|awk '{print "\t" $1"\t"$2"\t"$11}'
        elif [ "$2" = "k" ]; then
                ps aux |grep "$1" |grep -v "grep"|grep -v "/bin/sh"|awk '{print $2}'|xargs kill
        else
                echo "Useage:$0 processname l|k";
        fi
}
else
{
        echo "usage:
                list the match processor: `basename $0` processor2match l
                kill the match processor: `basename $0` processor2match k"
}
fi

  去掉注释:
#!/bin/sh
#name:clcom
#clear the comment
grep -v -e "^#" -e "^  *#" -e "^$" $1

暂无引用通告

发送引用通告网址: http://supersun.info/mt/mt-tb.cgi/525
如果您想引用这篇日记到您的Blog,请复制上面的链接,放置到您发表文章时的相应界面中。

发表评论

最新资源

  • IMG_1437.JPG
  • line.png
  • bar.png
  • perl_calander.jpg

关于此日记

此日记由 supersun 发表于 2007年2月 2日 17:32

此Blog上的上一篇日记音频播放器

此Blog上的下一篇日记Security-Enhanced Linux

首页归档页可以看到最新的日记和所有日记。