Statistics script to modify the C code

Statistics script to modify the C code

1 Introduction

This is a problem I encountered when statistical code amount. No matter how much I knocked code that script last semester with a teacher statistics the amount of code is always 0. Go back and ask the students learned last semester script can only be used to count the amount of Java code. Because it is a statistical suffix .java, and our semester related to C, so we can just .java changed .c.

2, modify

(1) most of the statistics began

Result when (2) modified

(3) before the amendment and the need to modify the place

And modified after (4) Modified point

3, the revised script

#!/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 "

Modify the script before the source link
support @ link

Guess you like

Origin www.cnblogs.com/cjy-123/p/11567678.html