首页 > 解决方案 > MacOS Bash find 和 echo 没有按预期工作?

问题描述

我正在处理一个应用程序卷,根据经验,我在我的命令echo之前添加一个。直到今天,这对我来说已经工作了很长时间。rmfind

我只是想知道如果有人能够看到如果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.

标签: bashmacosfindrm

解决方案


推荐阅读