Linux bash脚本可在所有子目录中运行make [英] Linux bash-script to run make in all subdirectories

查看:61
本文介绍了Linux bash脚本可在所有子目录中运行make的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在Linux中编写一个遍历当前目录的bash脚本,并在每个子目录中启动现有的makefile.不管深度如何,它都应该适用于每个子目录.

I'm trying to write a bash-script in Linux which traverses the current directory and, in every subdirectory, it launches the existing makefile. It should work for each subdirectory, regardless of depth.

一些限制:

  • 我无法使用Python;
  • 我事先不知道有多少个子目录及其名称;
  • 我不知道当前目录的名称;
  • 每个目录的make命令仅应在该文件夹中包含makefile的情况下启动.
  • I cannot use Python;
  • I don't know in advance how many subdirectories and their names;
  • I don't know in advance the name of current directory;
  • the make command for each directory should only be launched if there is makefile in such folder.

关于如何做到这一点的任何想法?

Any ideas on how to do it?

推荐答案

使用-exec和GNU

登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆