#!/bin/sh # code counter LOG="/tmp/log.$$" LINES=0 C=0 find| grep "\.c$" >$LOG find| grep "\.cpp$" >>$LOG find| grep "\.cxx$" >>$LOG find| grep "\.h$" >>$LOG find| grep "\.hpp$" >>$LOG find| grep "\.hxx$" >>$LOG find| grep "\.sh$" >>$LOG find| grep "\.S$" >>$LOG find| grep "\.ts$" >>$LOG find| grep "\.ui$" >>$LOG find| grep "\.qrc$" >>$LOG find| grep "\.bat$" >>$LOG find| grep "\.cmake$" >>$LOG find| grep "CMakeLists.txt" >>$LOG while read L do C=$((C+1)) W=$(cat $L|wc -l) S=$(cat $L|wc -c) SIZE=$((SIZE+S)) LINES=$((LINES+W)) done <$LOG rm $LOG echo echo "--- SOURCE CODE SUMMARY ---" echo "source path: $(pwd)" echo "source files: $C" echo "lines of code: $LINES" echo "size of code: $SIZE bytes" echo