今天忽然想知道最近本身到底写了多少行代码,因而乎用shell统计了一下最近的代码量: shell
1
|
find /home/chengshuguang/ManGo -maxdepth 1 -name '*.c' -or -name '*.cpp' -or -name '*.h' | xargs wc -l
|
其中: spa
-maxdepth 1表示只向下搜该目录,即不递归。同理 2 表示搜到2级目录 .net
xargs 它的做用是将参数列表转换成小块分段传递给其余命令,以免参数列表过长的问题。 orm
若是不想统计空行,其实还能够这样: blog
1
2
3
|
find . -name "*.m" -or -name "*.h" |xargs grep -v "^$"|wc -l
grep -v "^$"表示去除空行
|