zoukankan      html  css  js  c++  java
  • 【未解决】对于使用Windows的IDEA进行编译的文件,但无法在Linux系统中统计代码行数的疑问

    在我学习使用Windows的IDEA的过程中,将代码文件转移到Linux虚拟机当中,但无法在Linux系统中统计代码行数。

    注意:拷贝进虚拟机的文件均能编译运行。

    具体过程如下:

    root@yogile-VirtualBox:/alive/string# ls
    bin/  docs/  statistics.sh  string/  work/
    ##/shared/为虚拟机与宿主机的共享文件夹
    root@yogile-VirtualBox:/alive/string# cp -r /shared/idea/ ./      ##步骤一
    root@yogile-VirtualBox:/alive/string# ls
    bin/  docs/  idea/  statistics.sh  string/  work/
    
    root@yogile-VirtualBox:/alive/string# tree -a idea/
    idea/
    ├── BorderOfP(n,m)
        ├── BorderOfP(n,m).iml
        ├── .idea
        │   ├── misc.xml
        │    ├── modules.xml
        │    ├── .name
        │    ├── vcs.xml
        │    └── workspace.xml
        ├── out
        │   └── production
        │       ├── BorderOfP(n,m)
        │       ├── Arrangement.class
        │       ├── factorial.class
        │       └── struct.class
        └── src
            ├── Arrangement.java
            ├── factorial.java
            └── struct.java
    
    

    统计代码行数脚本statistics.sh来自使用码云和博客园学习简易教程,部分如下

    #!/bin/sh
    echo "//==========All================================="
    echo "code summary infomation:"
    find . -name "*.java"| xargs cat | grep -v ^$ | wc -l 
    echo ""
    

    然后执行脚本:

    root@yogile-VirtualBox:/alive/string# ./statistics.sh
    //==========All=================================
    code summary infomation:
    508
    xargs: cat:因信号 13 而终止
    

    注意 :在执行 <步骤一> 之前脚本运行结果如下:

    root@yogile-VirtualBox:/alive/string# ./statistics.sh
    //==========All=================================
    code summary infomation:
    508
    

    这时,如果将idea/中的文件夹BorderOfP(n,m)/直接复制进string/文件夹中,再执行脚本则成功:

    root@yogile-VirtualBox:/alive/string# cp -r idea/*/ string/
    root@yogile-VirtualBox:/alive/string# tree -a strong/
    string/
    ├── BorderOfP(n,m)
        ├── BorderOfP(n,m).iml
        ├── .idea
        │   ├── misc.xml
        │    ├── modules.xml
        │    ├── .name
        │    ├── vcs.xml
        │    └── workspace.xml
        ├── out
        │   └── production
        │       ├── BorderOfP(n,m)
        │       ├── Arrangement.class
        │       ├── factorial.class
        │       └── struct.class
        └── src
            ├── Arrangement.java
            ├── factorial.java
            └── struct.java
    
    root@yogile-VirtualBox:/alive/string# ./statistics.sh
    //==========All=================================
    code summary infomation:
    842
    xargs: cat:因信号 13 而终止
    

    这时,哪怕新建一个新的文件夹,将string/内的文件移动进去,依然为:

    root@yogile-VirtualBox:/alive/string# mkdir retry
    root@yogile-VirtualBox:/alive/string# mv string/*/ retry/
    root@yogile-VirtualBox:/alive/string# ./statistics.sh
    //==========All=================================
    code summary infomation:
    508
    xargs: cat:因信号 13 而终止
    

    在同样的条件下删除.idea文件夹依然不成功
    在同样的条件下删除.xml文件依然不成功
    在同样的条件下修改文件或文件夹权限依然不成功
    在同样的条件下在脚本中添加'-maxdepth'依然不成功

    这个问题依然无法解决,希望得到大佬们的解答。

  • 相关阅读:
    叶树:任总喊你回家吃饭 (zz)
    一个小员工如何让一家大银行一夕倒闭(附几则)
    精妙SQL语句收集
    降温了 降温了
    東京タワー初めてphoto
    圣诞气氛photo
    初冬071110photo
    超级郁闷的一天
    eveningplan
    KOF怀念ING
  • 原文地址:https://www.cnblogs.com/Yogile/p/10505658.html
Copyright © 2011-2022 走看看