find命令批量压缩的奇怪现象
时间:2010-12-23
来源:互联网
请教各位前辈,我想用find -exec 方式将/home/bubu下边的sh脚本批量打为一个test.tar包到/tar_test目录下,用以下命令实现后发现test.tar里边只有find找出的最后一个文件(4.sh)
因此十分疑惑,请各位前辈指点迷津并指正,谢谢!
以下是全部需要打包的sh文件
[root@localhost shell_test]# find /home/bubu/ -type f -name "*.sh" -print
/home/bubu/cgi0.sh
/home/bubu/1.sh
/home/bubu/install/Python-2.6.4/Demo/cgi/cgi0.sh
/home/bubu/install/Python-2.6.4/Misc/build.sh
/home/bubu/install/Python-2.6.4/Tools/faqwiz/move-faqwiz.sh
/home/bubu/build.sh
/home/bubu/2.sh
/home/bubu/guoyue.sh
/home/bubu/time.sh
/home/bubu/ping.sh
/home/bubu/3.sh
/home/bubu/guo.sh
/home/bubu/shell_test/sh/test/try/yyy.sh
/home/bubu/shell_test/sh/test/sdsd.sh
/home/bubu/shell_test/sh/1.sh
/home/bubu/shell_test/sh/2.sh
/home/bubu/shell_test/sh/3.sh
/home/bubu/shell_test/sh/6.sh
/home/bubu/shell_test/sh/4.sh
/home/bubu/shell_test/guoyue.sh
/home/bubu/shell_test/time.sh
/home/bubu/shell_test/ping.sh
/home/bubu/shell_test/guo.sh
/home/bubu/shell_test/tar.sh
/home/bubu/shell_test/mail.sh
/home/bubu/shell_test/home/bubu/shell_test/guo.sh
/home/bubu/yyy.sh
/home/bubu/tar.sh
/home/bubu/bubububububu.sh
/home/bubu/sdsd.sh
/home/bubu/6.sh
/home/bubu/mail.sh
/home/bubu/4.sh
下边是针对上边打包的命令
[root@localhost shell_test]# find /home/bubu/ -type f -name "*.sh" -exec tar -czvPf /tar_test/test.tar {} \;
因此十分疑惑,请各位前辈指点迷津并指正,谢谢!

以下是全部需要打包的sh文件
[root@localhost shell_test]# find /home/bubu/ -type f -name "*.sh" -print
/home/bubu/cgi0.sh
/home/bubu/1.sh
/home/bubu/install/Python-2.6.4/Demo/cgi/cgi0.sh
/home/bubu/install/Python-2.6.4/Misc/build.sh
/home/bubu/install/Python-2.6.4/Tools/faqwiz/move-faqwiz.sh
/home/bubu/build.sh
/home/bubu/2.sh
/home/bubu/guoyue.sh
/home/bubu/time.sh
/home/bubu/ping.sh
/home/bubu/3.sh
/home/bubu/guo.sh
/home/bubu/shell_test/sh/test/try/yyy.sh
/home/bubu/shell_test/sh/test/sdsd.sh
/home/bubu/shell_test/sh/1.sh
/home/bubu/shell_test/sh/2.sh
/home/bubu/shell_test/sh/3.sh
/home/bubu/shell_test/sh/6.sh
/home/bubu/shell_test/sh/4.sh
/home/bubu/shell_test/guoyue.sh
/home/bubu/shell_test/time.sh
/home/bubu/shell_test/ping.sh
/home/bubu/shell_test/guo.sh
/home/bubu/shell_test/tar.sh
/home/bubu/shell_test/mail.sh
/home/bubu/shell_test/home/bubu/shell_test/guo.sh
/home/bubu/yyy.sh
/home/bubu/tar.sh
/home/bubu/bubububububu.sh
/home/bubu/sdsd.sh
/home/bubu/6.sh
/home/bubu/mail.sh
/home/bubu/4.sh
下边是针对上边打包的命令
[root@localhost shell_test]# find /home/bubu/ -type f -name "*.sh" -exec tar -czvPf /tar_test/test.tar {} \;
作者: chenduo911 发布时间: 2010-12-23
先建一个空tar,
用find 。。。 -exec tar -azvPf 。。。
试试
用find 。。。 -exec tar -azvPf 。。。
试试
作者: shenyue_sam 发布时间: 2010-12-24
tar -czvPf test.tar `find /home/bubu -name "*.sh"` 就可以
`` 非 ' '
`` 非 ' '
作者: taojie2000 发布时间: 2010-12-24
回复 taojie2000
请教下,一直看``字符比较常见,能否举例说明下具体的用法、功能、还有扩展用法等? 多谢指教!
请教下,一直看``字符比较常见,能否举例说明下具体的用法、功能、还有扩展用法等? 多谢指教!
作者: chenduo911 发布时间: 2010-12-24
回复 chenduo911
倒引号 `` 括起来的被解释为命令行 具体你可以查查资料
倒引号 `` 括起来的被解释为命令行 具体你可以查查资料
作者: taojie2000 发布时间: 2010-12-24
相关阅读 更多
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28