LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
12
返回列表 发新帖
楼主: hustwei

我写了个统计源码的脚本,各位帮我完善下吧

[复制链接]
发表于 2008-2-3 12:32:37 | 显示全部楼层
没效率,但是可行,哈哈
$ cat count.sh
#! /bin/bash

echo -n "*.c: "
find ~/src -name '*.c' -print0 | xargs -0 wc -l | sed -n -e '$s/\([0-9].*\) .*/\1/p'
echo -n "*.h: "
find ~/src -name '*.h' -print0 | xargs -0 wc -l | sed -n -e '$s/\([0-9].*\)  .*/\1/p'
$ chmod 0700 count.sh
$ ./count.sh
*.c: 1347
*.h: 34
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表