Skip to main content
Topic: Linux way/command to make a script running from every subdir (Read 385 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Linux way/command to make a script running from every subdir

Sorry if not really Artix but no/little attention on many other forums

How is the find command (or else if better) to let us run a script from, i.e. relative to, every subdir under, and including, current working directory ?

illustratio e.g. script is
Code: [Select]
grep 'foo' *

Re: Linux way/command to make a script running from every subdir

Reply #1
Sorry if not really Artix but no/little attention on many other forums

How is the find command (or else if better) to let us run a script from, i.e. relative to, every subdir under, and including, current working directory ?

illustratio e.g. script is
Code: [Select]
grep 'foo' *
I would do it this way:
Code: [Select]
find . -type d -exec sh -c 'cd {} && command' ';'