uyetch
uyetch

Reputation: 2190

Traversing directories using shell script

I am trying to traverse all directories under the current directory using a shell script. In each of those sub directories, there is a makefile and I want to execute it. Any idea how to do ?

Upvotes: 3

Views: 542

Answers (1)

Cédric Julien
Cédric Julien

Reputation: 80761

Try with find :

find -iname makefile -execdir make -f {} \;

That will find every file named makefile (or Makefile, or whatever different case for word makefile, thanks to thiton) (recursively) and then launch make against it.

Upvotes: 3

Related Questions