列出Linux源码下所有Makefile的方法
一、要求:
1、能够显示出Makefile的总数
2、能显示一级目录下的Makefile总数、Makefile列表及其Makefile的内容
3、能将上述内容写入相应的文件
二、实例
rm -rf ~/Desktop/linux_Makefile/*
for i in `find . -maxdepth 1 -type d`
#仅仅是当前目录,所以请将本脚本放在linux源码目录下执行。
do
echo $i
mkdir -p ~/Desktop/linux_Makefile/$i
find $i -type f -name "Makefile" -print | echo -e ""$i" Total is:`wc -l`" >> ~/Desktop/linux_Makefile/total_Makefile_list_about.txt
#
Makefile的总数
find $i -type f -name "Makefile" -print | echo -e "\n"$i"'s Makefile Total number is:`wc -l`\n" > ~/Desktop/linux_Makefile/$i/"$i"_Makefile_list.txt
find $i -type f -name "Makefile" -print >> ~/Desktop/linux_Makefile/$i/"$i"_Makefile_list.txt
find $i -type f -name "Makefile" -printf "\n# ============================================================\n# " -print -printf "# ============================================================\n\n" -exec cat {} \; >> ~/Desktop/linux_Makefile/$i/"$i"_Makefile_content.txt
done
mv ~/Desktop/linux_Makefile/._Makefile_content.txt ~/Desktop/linux_Makefile/total_Makefile_content.txt
mv ~/Desktop/linux_Makefile/._Makefile_list.txt ~/Desktop/linux_Makefile/total_Makefile_list.txt
三、扩展成通用的文件归纳程序
相关文档:
Service Discovery Protocol(SDP)提供一种能力,让应用程序有方法发现哪种服务可用以及这种服务的特性。
服务发现协议(SDP或Bluetooth SDP)在蓝牙协议栈中对蓝牙环境中的应用程序有特殊的含意,发现哪个服务是可用的和确定这些可用服务的特征。SDP定义了bluetooth client发现可用bluetooth server服务和它们的特征的方法。 ......
如何在linux下查看当前登录的用户,并且踢掉你认为应该踢掉的用户?
看了网络中的一些例子.在这里总结一下.主要用到的命令有,w,who,ps,kill,pkill
查看当前登录用户:
node8:/home # who
root :0 2009-11-04 16:26
root pts/0 &n ......
六:kmem_cache_alloc的实现分析:
我们在上面可以看到,创建一个cache描述符的时候,并没有这之分配slab数据。现在我们来看一下怎么从cache中申请对象
void * kmem_cache_alloc (kmem_cache_t *cachep, int flags)
{
return __cache_alloc(cachep, flags);
}
实际上会调用__cache_allo ......
#include <stdio.h>
#include <unistd.h>
#define FOO "foo"
int main(void)
{
if(!access(FOO, F_OK))
{
if(!unlink(FOO))
{
}
else
{
printf("remove %s failed\n", FOO);
}
}
else
{
printf("%s not existed\ ......