bash - MacOS Bash find 和 echo 没有按预期工作?
问题描述
我正在处理一个应用程序卷,根据经验,我在我的命令echo
之前添加一个。直到今天,这对我来说已经工作了很长时间。rm
find
我只是想知道如果有人能够看到如果find
不尊重会发生echo
什么?
$ find . -type d -name 'webappsbak' -exec echo rm -rf {} \;
rm -rf ./jetty_ios_2/webappsbak
rm -rf ./jetty/webappsbak
rm -rf ./jetty_0/webappsbak
rm -rf ./jetty_ios/webappsbak
rm -rf ./jetty_ios_1/webappsbak
rm -rf ./jetty_t/webappsbak
rm -rf ./jetty_b/webappsbak
rm -rf ./jetty_b/jetty_0/webappsbak
$ find . -type d -name 'webappsbak' -exec rm -rf {} \;
find: ./jetty_ios_2/webappsbak: No such file or directory
find: ./jetty/webappsbak: No such file or directory
find: ./jetty_0/webappsbak: No such file or directory
find: ./jetty_ios/webappsbak: No such file or directory
find: ./jetty_ios_1/webappsbak: No such file or directory
find: ./jetty_t/webappsbak: No such file or directory
find: ./jetty_b/webappsbak: No such file or directory
find: ./jetty_b/jetty_0/webappsbak: No such file or directory
$ bash --version
GNU bash, version 5.0.11(1)-release (x86_64-apple-darwin19.0.0)
Copyright (C) 2019 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
解决方案
推荐阅读
- python - 在 PyCharm 中没有添加 WSL python 解释器的菜单
- gremlin - Gremlin - 更新或插入多个顶点
- sharepoint - sharepoint 2013 列表日期时间选择器选择年份
- javascript - 对对象进行排序,以使最大的嵌套数组排在第一位
- python - 无法打开 lib '/usr/local/lib/libmsodbcsql.13.dylib':找不到文件 - 但文件存在
- reactjs - 根据事件更改标题
- julia - 如何定义以索引值为条件的 JuMP 表达式
- docker - 无法让 docker healthcheck 与 ECS Fargate v 1.4.0 一起使用
- wordpress - 将数据返回到页面的用户输入处理程序
- nosql - 选择正确的方法来使用 Azure Cosmos DB (MongoDB) 构建多租户体系结构