5 codefile_list=(.c .cpp .h .java .pl .py .sh)
6 for ((i=0 ; i < ${#codefile_list[@]}; i++)); do
7 if [ ! -z "$phrases" ]; then
10 phrases="$phrases -iname *${codefile_list[i]}"
12 #echo phrases is now $phrases
15 export NAME_LIST_TEMP_FILE="$(mktemp "$TMP/zz_code_count.XXXXXX")"
19 if [ -z "$dir" ]; then
26 ##hmmm: how to turn off tracing thing?
28 find "$dir" -type f $phrases >$NAME_LIST_TEMP_FILE
30 #echo ====================================================
31 #echo file holds these matches:
32 #cat $NAME_LIST_TEMP_FILE
33 #echo ====================================================
37 count=$(grep -h -v -c "^[ ]*$" $line)
38 TOTALS=$(($TOTALS + $count))
39 #echo total is $TOTALS now
40 done < "$NAME_LIST_TEMP_FILE"
42 rm $NAME_LIST_TEMP_FILE
46 echo "total lines of code=$TOTALS"