【发布时间】:2021-01-02 21:23:12
【问题描述】:
大家好,我是 bash 的新手,需要一些非常简单但不知道的东西。我需要一个在管道中调用的 bash 脚本来查找特定文件“terragrunt.hcl”。 bash 应该从目录(A)及其子目录(B、C、D、E 等)开始查找,然后在每个“terragrunt.hcl”文件上执行 2 个命令,但是从目录内部执行这 2 个命令文件所在的位置。
如果我要“手工”做,它看起来像这样:
cd A
(if terragrunt.hcl exist execute **command 1 && command 2** on terragrunt.hcl)
cd ../B
(if terragrunt.hcl exist execute **command 1 && command 2** on terragrunt.hcl)
cd ../C
(if terragrunt.hcl exist execute **command 1 && command 2** on terragrunt.hcl)
到目前为止,我并没有真正找到任何真正有用的东西。我在网上找到了这个(https://unix.stackexchange.com/questions/295965/how-to-use-find-exec-to-execute-command-in-directory-of-found-file-not-curre),但它并没有执行我正在寻找的东西。 任何帮助将不胜感激。
【问题讨论】:
标签: bash