#! /bin/bash filesCount=0 linesCount=0 function funCount() { for file in `ls $1` do if [[ "$file" == "conf" ]];then if [ -d $file ]; then continue fi elif [ -d $1"/"$file ];then funCount $1"/"$file elif [[ "$file" == *.o ]];then continue elif [[ "$file" == *.a ]];then continue elif [[ "$file" == *.so ]];then continue elif [ -L $1"/"$file ];then continue #elif [[ "$file" == "conf" ]];then # continue else declare -i fileLines fileLines=`awk 'BEGIN{count=0} { count++ } END{print count}' $1"/"$file ` let linesCount=$linesCount+$fileLines let filesCount=$filesCount+1 fi done } if [ $# -gt 0 ];then for m_dir in $@ do funCount $m_dir done else
funCount "." fi
排除了库文件,配置文件,软连接的情况