cp xxx/*.sh aaa
知道这个

解决方案 »

  1.   

    这个不可以,报告No such file or directory.
      

  2.   

    这个不可以,报告No such file or directory.这个只能复制xxx目录下的.sh文件,你看看是不是在xxx的上级目录下执行这个命令的
      

  3.   

    find xxx/ -name "*.sh" -exec cp {}  AAAA/  \;
      

  4.   

    find xxx/ -name "*.sh" 是查找出目录及子目录中的目标文件,  -exec 代表继续执行一个命令 , {} 代表 刚才查找出的结果,  最后要加上 \; 
      

  5.   

    cp xxx/*.sh aaa
    cp xxx/*/*.sh aaa
      

  6.   


    octopus@octopus:~/english$ tree
    .
    ├── AAAA
    └── xxx
        ├── a.sh
        └── B
            └── b.sh3 directories, 2 files
    octopus@octopus:~/english$ find xxx -name "*.sh" -exec cp {} AAAA/  \;
    octopus@octopus:~/english$ tree
    .
    ├── AAAA
    │   ├── a.sh
    │   └── b.sh
    └── xxx
        ├── a.sh
        └── B
            └── b.sh3 directories, 4 files
    亲测 可用
      

  7.   

    推荐两本书 看去吧Linux命令行与shell脚本编程大全(第2版)
    O'Reilly:Shell脚本学习指南