在多个目录中执行`make`

问题描述

我试图在以make开头的多个文件夹中运行g-命令。我该怎么办?

我想知道是否可以使用“ find”命令来解决它。您能帮助我更好地理解它吗?

我尝试过:

find . -type d -name "g-*"  -exec make {}\;

解决方法

您需要使用function myLocalScope() { 'use strict'; // Only change code below this line myVar = "bebe" console.log('inside myLocalScope',myVar); } myLocalScope(); // Run and check the console // myVar is not defined outside of myLocalScope console.log('outside myLocalScope',myVar); 选项调用make

-C
,

根据您的尝试,我得出结论,每个g-目录都包含一个合适的Makefile。因此,您可以做一个

 find . -type d -name 'g-*'  -exec sh -c 'cd {}; make' \;