Shell统计代码行数
2013-06-14 20:52
232 查看
本博文为原创,遵循CC3.0协议,转载请注明出处:/article/8087639.html
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
最近想统计一下研究生两年以来的代码量,于是写了个简单的bash脚本。
目录结构相对简单,脚本也没有过多测试,贴出来大家玩:
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
最近想统计一下研究生两年以来的代码量,于是写了个简单的bash脚本。
目录结构相对简单,脚本也没有过多测试,贴出来大家玩:
#!/bin/sh # specify the path after the executable bash script # eg. ./count_lines my_path # this will count current dir if parameter is null COUNT=0 func_count() { for file in `ls $1` ; do DIR=$1/$file if [ -f $DIR ] ; then COUNT=$(($COUNT+`sudo wc -l $DIR | cut -d " " -f 1`)) elif [ -d $DIR ] ; then func_count $DIR fi done } if [ ! -n "$1" ]; then func_count . else func_count $1 fi echo "the total num is: $COUNT"
相关文章推荐
- 一句shell命令搞定代码行数统计
- shell统计文件夹代码行数
- 一条shell统计代码行数
- 一条shell统计代码行数
- 一句shell命令搞定代码行数统计
- shell 统计程序代码行数
- 采用shell脚本统计代码的行数
- linux下shell统计文件目录下所有代码行数
- 一个用shell写的统计目录下统计文件行数的代码
- Shell统计代码行数
- 利用shell脚本统计代码行数
- 一条shell指令统计项目的代码行数
- shell 命令统计代码行数的简单代码
- shell工程代码行数统计
- 一句shell命令搞定代码行数统计
- Shell脚本实现C语言代码行数统计
- 一条shell统计代码行数
- shell统计代码行数
- [转] 一句shell命令搞定代码行数统计
- 一句shell命令搞定代码行数统计