這是我統計代碼量時碰到的一個問題。不管我敲了多少代碼,用老師上學期的那個腳本統計的代碼量始終爲0。回去問了同窗,瞭解到上學期的腳本只能用來統計Java的代碼量。由於它統計的後綴是.java,而咱們這學期的學習與C相關,所以,咱們只需將.java改成.c便可。html
#!/bin/sh clear echo "//==========Today=====================================" echo "code summary infomation:" find . -name "*.c" -mtime 0 | xargs cat | grep -v ^$ | wc -l echo "documents summary infomation:" find . -name "*.md" -mtime 0 | xargs cat | grep -v ^$ | wc -l echo "" echo "//==========This Week=================================" echo "code summary infomation:" find . -name "*.c" -mtime -7| xargs cat | grep -v ^$ | wc -l echo "documents summary infomation:" find . -name "*.md" -mtime -7| xargs cat | grep -v ^$ | wc -l git log --pretty=format:"%h - %an,%ci: %s " | grep `date +%F --date="-0 days"` git log --pretty=format:"%h - %an,%ci: %s " | grep `date +%F --date="-1 days"` git log --pretty=format:"%h - %an,%ci: %s " | grep `date +%F --date="-2 days"` git log --pretty=format:"%h - %an,%ci: %s " | grep `date +%F --date="-3 days"` git log --pretty=format:"%h - %an,%ci: %s " | grep `date +%F --date="-4 days"` git log --pretty=format:"%h - %an,%ci: %s " | grep `date +%F --date="-5 days"` git log --pretty=format:"%h - %an,%ci: %s " | grep `date +%F --date="-6 days"` echo "" echo "" echo "//==========All=================================" echo "code summary infomation:" find . -name "*.c"| xargs cat | grep -v ^$ | wc -l echo "documents summary infomation:" find . -name "*.md"| xargs cat | grep -v ^$ | wc -l echo "commit history:" git log --pretty=format:"%h - %an,%ci: %s "