exec命令

exec解释:

find . -type f -mtime +14 -exec rm {} \; 

如上所示,-exec  后面跟要执行的命令,然后是{ },一个空格和一个\,最后是一个分号。 它的终止是以;为结束标志的,所以这句命令后面的分号是不可缺少的,考虑到各个系统中分号会有不同的意义,所以前面加反斜杠转义

{}   花括号里面传入find到的内容

 

1、exec安全删除模式  它将在对每个匹配到的文件进行操作之前提示你

[root@localhost] ~$ find . -name "*.txt" -ok rm {} \;
< rm ... ./xargs.txt > ? n
< rm ... ./temp.txt > ? n
< rm ... ./t t.txt > ? n
< rm ... ./out2.txt > ? n

 

posted @ 2018-02-25 11:12  fanren224  阅读(182)  评论(0编辑  收藏  举报