zoukankan      html  css  js  c++  java
  • C代码统计脚本修改

    C代码统计脚本修改

    1、简介

    这是我统计代码量时碰到的一个问题。无论我敲了多少代码,用老师上学期的那个脚本统计的代码量始终为0。回去问了同学,了解到上学期的脚本只能用来统计Java的代码量。因为它统计的后缀是.java,而我们这学期的学习与C相关,因此,我们只需将.java改为.c即可。

    2、修改

    (1)最开始进行统计的量

    (2)修改后运行的结果

    (3)修改前及需要修改的地方

    (4)修改后及修改过的地方

    3、修改后的脚本

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

    修改前脚本来源链接
    技术支持@链接

  • 相关阅读:
    P3158 [CQOI2011]放棋子
    Codeforces 1220D. Alex and Julian
    Codeforces 1220C. Substring Game in the Lesson
    Codeforces 1220B. Multiplication Table
    BZOJ 3260. 跳
    BZOJ 3251. 树上三角形
    P1398 [NOI2013]书法家
    P1224 [NOI2013]向量内积
    The Preliminary Contest for ICPC Asia Shanghai 2019 A. Lightning Routing I
    P4271 [USACO18FEB]New Barns
  • 原文地址:https://www.cnblogs.com/cjy-123/p/11567678.html
Copyright © 2011-2022 走看看