AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题 / 72978
Accepted
yanchenko
yanchenko
Asked: 2009-10-10 07:12:55 +0800 CST2009-10-10 07:12:55 +0800 CST 2009-10-10 07:12:55 +0800 CST

rm {} + 做什么?

  • 772

如在

find -L /etc/ssl/certs/ -type l -exec rm {} +

所以它会找到所有损坏的符号链接并删除它们。但是我究竟该如何解释这{} +部分呢?

unix
  • 2 2 个回答
  • 7875 Views

2 个回答

  • Voted
  1. Ben S
    2009-10-10T07:15:17+08:002009-10-10T07:15:17+08:00

    来自man find:

       -exec command {} +
       This variant of the -exec option runs the specified  command  on
       the  selected  files, but the command line is built by appending
       each selected file name at the end; the total number of  invoca-
       tions  of  the  command  will  be  much  less than the number of
       matched files.  The command line is built in much the  same  way
       that  xargs builds its command lines.  Only one instance of '{}'
       is allowed within the command.  The command is executed  in  the
       starting directory.
    

    所以它会调用命令:

    rm [filename1] [filename2] [...] [lastfilename]
    

    如果文件数量超出参数列表的容量,rm则将多次调用。(这就是这样xargs做的。)

    没有它,{} +它只会调用rm很多次而没有参数。

    • 12
  2. Best Answer
    Insyte
    2009-10-10T07:17:37+08:002009-10-10T07:17:37+08:00

    该{}位是exec命令的占位符。find 找到的任何文件都将插入以代替括号。建立一长串找到的文件并立即对所有文件调用 exec的方法,而不是像更传统的变体+那样一次一个。-exec {} \;

    • 6

相关问题

  • Windows 有符号链接吗?

  • 控制 UNIX 目录内容用户组所有权

  • 在命令行上从 csv 文件中过滤带有空格字符的字段

  • 如何将 VAR 从子 shell 导出到父 shell?

  • 查找文件大小(以 MB 为单位)

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    从 IP 地址解析主机名

    • 8 个回答
  • Marko Smith

    如何按大小对 du -h 输出进行排序

    • 30 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    Windows 中执行反向 DNS 查找的命令行实用程序是什么?

    • 14 个回答
  • Marko Smith

    如何检查 Windows 机器上的端口是否被阻塞?

    • 4 个回答
  • Marko Smith

    我应该打开哪个端口以允许远程桌面?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    MikeN 在 Nginx 中,如何在维护子域的同时将所有 http 请求重写为 https? 2009-09-22 06:04:43 +0800 CST
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    0x89 bash中的双方括号和单方括号有什么区别? 2009-08-10 13:11:51 +0800 CST
  • Martin Hope
    kch 如何更改我的私钥密码? 2009-08-06 21:37:57 +0800 CST
  • Martin Hope
    Kyle Brandt IPv4 子网如何工作? 2009-08-05 06:05:31 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve