报错提示:find: missing argument to `-exec'

今天写一个清理脚本,用到了find命令。本来是这么写的:

find . -type f -mtime +7 -name "*.log" -exec rm -rf {} \

结果报错,find: missing argument to `-exec'

后来一查,发现两个会导致此问题的原因。

1. "{}"和"\"之间要有空格

2. 此语句末尾需要分号

3.最后的"\"和分号中间不能有空格

很显然,我没加分号。
 
所以将此shell语句末尾加一个分号即可正常运行。

find . -type f -mtime +7 -name "*.log" -exec rm -rf {} \;

Linux-find命令报错: missing argument to `-exec'的更多相关文章

  1. Linux pip命令报错 -bash: pip: command not found

    下载 $ wget https://bootstrap.pypa.io/get-pip.py 安装 $ python get-pip.py 查看版本 $ pip -V 查看安装路径: find / - ...

  2. Linux执行命令报错:Permission denied

    原因:权限被拒 结局办法 chmod -R 777 目录名 更改目录内文件的权限即可

  3. linux报错 find: missing argument to `-exec'

    在linux下使用find命令时,报错:find: missing argument to `-exec' 具体执行命令为: find /u03 -name server.xml -exec grep ...

  4. RedHat中敲sh-copy-id命令报错:-bash: ssh-copy-id: command not found

    RedHat中敲sh-copy-id命令报错:-bash: ssh-copy-id: command not found 在多台Linux服务器SSH相互访问无需密码, 其中进入一台Linus中,对其 ...

  5. maven中引入oracle驱动报错Missing artifact com.oracle:ojdbc14:jar:10.2.0.4.0

    转自https://blog.csdn.net/lovesomnus/article/details/49512777 在maven中央库中查找ojdbc,发现最新的版本是10.2.0.4.0,然后在 ...

  6. 【jvm】linux 调用 jmap 报错Permission denied

    linux 调用 jmap  报错Permission denied 解决方案: 分别对java安装目录,java的bin目录以及jmap命令设置权限 chmod jdk1..0_79 chmod b ...

  7. Linux常见英文报错中文翻译(菜鸟必知)

    Linux常见英文报错中文翻译(菜鸟必知) 1.command not found 命令没有找到 2.No such file or directory 没有这个文件或目录 3.Permission ...

  8. windows下使用GNU make命令报错的解决方法

    windows下使用GNU make命令报错的解决方法=> 错误信息:make: Interrupt/Exception caught (code = 0xc00000fd, addr = 0x ...

  9. Python3安装Celery模块后执行Celery命令报错

    1 Python3安装Celery模块后执行Celery命令报错 pip3 install celery # 安装正常,但是执行celery 命令的时候提示没有_ssl模块什么的 手动在Python解 ...

  10. Linux常见英文报错中文翻译

    Linux常见英文报错中文翻译(菜鸟必知) 1.command not found 命令没有找到 2.No such file or directory 没有这个文件或目录 3.Permission ...

随机推荐

  1. 基于 SpringBoot + magic-api + Vue3 + Element Plus + amis3.0 快速开发管理系统

    Tansci-Boot 基于 SpringBoot2 + magic-api + Vue3 + Element Plus + amis3.0 快速开发管理系统 Tansci-Boot 是一个前后端分离 ...

  2. poj 2533 LIS(最长上升序列)

    ***一道裸题, 思路:在g数组内往里加元素,一直扩大这个数组,每次查询的时候,用二分查找,时间复杂度O(nlog(n)) *** #include<iostream> #include& ...

  3. Liunx运维(一)-命令行

    一.命令行的开启与推出 1.exit 2.logout 3.ctrl+d   二.命令行提示符 1.#root用户 2.$普通用户 3.~当前用户所在的路径 4.全局配置文件: /etc/profil ...

  4. 【解决方案】如何使用 Http API 代替 OpenFeign 进行远程服务调用

    目录 前言 一.何为OpenFeign 1.1@FeignClient注解 1.2注意事项 二.常见的Http API 2.1Apache 2.2Okhttp 2.3Hutool 三.RestTemp ...

  5. 【TouchGFX】使用CubeMX创建touchgfx项目 -- 初始篇

    1.系统构成,黑色块表示组件非必须 2.环境准备 CubeMX:6.0.1 touchgfx:4.15.0 rt-thread:2020-8-14 commit Keil:5.30 board:stm ...

  6. [转帖]pod容器开启pid限制

    https://zhdya.gitee.io/zhdya/archives/   cgroup中对pid进行了隔离,通过更改docker/kubelet配置,可以限制pid总数,从而达到限制线程总数的 ...

  7. [转帖]SQL Server 2008~2022版本序列号/密钥/激活码 汇总

    https://www.cnblogs.com/cqpanda/p/16148822.html SQL Server 2022# Enterprise: J4V48-P8MM4-9N3J9-HD97X ...

  8. [转帖]prometheus和node_exporter中的磁盘监控

    https://www.ipcpu.com/2021/04/prometheus-node_exporter/ prometheus和node_exporter中的磁盘监控.md 对于磁盘问题,我们主 ...

  9. [转帖]Linux系统下cpio命令详解

    简介 cpio主要是解压或者将文件压缩到指定文件中即copy-in和copy-out模式. 参数说明 参数 参数说明 -i copy-in模式,解压文件 -o copy-out模式,即压缩文件 -d ...

  10. 【转帖】FIO磁盘性能测试工具

    https://www.jianshu.com/p/70b8c7d5d217 FIO工具介绍 FIO 工具是一款用于测试硬件存储性能的辅助工具,兼具灵活性.可靠性从而从众多性能测试工具中脱颖而出.磁盘 ...