linux find命令之exec简单概述
发布时间:2021-03-15 21:45:04 所属栏目:安全 来源:网络整理
导读:find是我们很常用的一个Linux命令,但是我们一般查找出来的并不仅仅是看看而已,还会有进一步的操作,这个时候exec的作用就显现出来了。 exec解释: -exec 参数后面跟的是command命令,它的终止是以;为结束标志的,所以这句命令后面的分号是不可缺少的,考虑
输出: [root@localhost test3]# ll 总计 0 [root@localhost test3]# cd .. [root@localhost test]# ll 总计 316 -rw-r--r-- 1 root root 302108 11-03 06:19 log2012.log -rw-r--r-- 1 root root 61 11-12 22:44 log2013.log -rw-r--r-- 1 root root 0 11-12 22:25 log2014.log drwxr-xr-x 6 root root 4096 10-27 01:58 scf drwxrwxr-x 2 root root 4096 11-12 22:50 test3 drwxrwxr-x 2 root root 4096 11-12 19:32 test4 [root@localhost test]# find . -name "*.log" -exec cp {} test3 ; cp: “./test3/log2014.log” 及 “test3/log2014.log” 为同一文件 cp: “./test3/log2013.log” 及 “test3/log2013.log” 为同一文件 cp: “./test3/log2012.log” 及 “test3/log2012.log” 为同一文件 [root@localhost test]# cd test3 [root@localhost test3]# ll 总计 304 -rw-r--r-- 1 root root 302108 11-12 22:54 log2012.log -rw-r--r-- 1 root root 61 11-12 22:54 log2013.log -rw-r--r-- 1 root root 0 11-12 22:54 log2014.log [root@localhost test3]# 以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持编程小技巧。 (编辑:淮安站长网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |