This is a follow up question regarding Bash: Execute a command in each directory with file my_suites.cfg?
The global recursive iteration in the answer in the original question is a bit too strong. I would like to limit it by checking the handled folders' names.
- I will execute this script in a root folder which contains folders with the substring Bl.
- There is a subfolder inside each Bl folder which contains the substring test.
- Inside the *test folder there is usually a bin folder containing my_suites.cfg. I want to execute a variant of make command here.
There are further subfolders in *Bl folders which has the substring LwU which will contain a similar structure for the my_suites.cfg. With the previous answer using global iteration, it will traverse all of of these and it takes too long.
Is it possible to check substring of the folder's name during iteration so that any folder's with substring LwU will be skipped?
EDIT: Answer from previous question that I'm referring to:
shopt -s globstar for d in **/; do if [[ -f "$d/my_suites.cfg" ]]; then cd "$d"; make; cd -; fi; done
Example of directory structure of a Bl folder. I want to execute commands in the test/bin folder located in the Bl folder. The test/bin folder does not necessarily have the name "test" but will contain my_suites.cfg. The folder can be named extra_test for example. There is a similar structure for the subfolder innerModuleSwU. These folders will contain the substring SwU. I want to skip processing these.
├── placeholderBl │ ├── doc │ │ ├── my_suites.cfg │ │ └── src │ ├── my_suites.cfg │ ├── someFolderIfU │ ├── innerModuleSwU │ │ ├── export │ │ ├── src │ │ └── test │ │ ├── bin │ │ │ └── my_suites.cfg │ │ └── src │ ├── test │ │ ├── bin │ │ │ ├── build.spec │ │ │ ├── my_suites.cfg │ │ ├── src