steven-zhou 发表于 2013-2-5 01:37:53

统计目录下C代码的总行数

#!/bin/sh## Line Counter## Usage: lcnt dir suffix1, suffix2, suffix3 ...#v_dir="$1"v_linenum=0if [ $# = 0 ]; then    echo "============================================="    echo "Usage: lcnt dir suffix1 suffix2 suffix3 ..."    echo "Usage: lcnt dir                              "    echo "============================================="elif [ $# = 1 ]; then    v_linenum=$(find $v_dir -type f | xargs -i cat {} | wc -l)    echo "Total: "$v_linenumelse    while [ "$2" != "" ]; do      v_linenum=$(find $v_dir -type f -name "*$2" | xargs -i cat {} | wc -l)      echo "*$2: "$v_linenum      shift    donefiexit 0
页: [1]
查看完整版本: 统计目录下C代码的总行数