For loops with find are evil for a lot of reasons, one of which is spaces:
$ tree . ├── arent good with find loops │ ├── a │ └── innerdira │ └── docker-compose.yml └── dirs with spaces ├── b └── innerdirb └── docker-compose.yml 3 directories, 2 files $ for y in $(find .); do echo $y; done . ./are t good with fi d loops ./are t good with fi d loops/i erdira ./are t good with fi d loops/i erdira/docker-compose.yml ./are t good with fi d loops/a ./dirs with spaces ./dirs with spaces/i erdirb ./dirs with spaces/i erdirb/docker-compose.yml ./dirs with spaces/b
You can kinda fix that with IFS:
$ OIFS=$IFS $ IFS=$'\n' $ for y in $(find .); do echo "$y"; done . ./arent good with find loops ./arent good with find loops/innerdira ./arent good with find loops/innerdira/docker-compose.yml ./arent good with find loops/a ./dirs with spaces ./dirs with spaces/innerdirb ./dirs with spaces/innerdirb/docker-compose.yml ./dirs with spaces/b $ IFS=$OIFS
But you can also use something like:
find . -name 'docker-compose.yml' -printf '%h\0' | xargs -0 ...
or in your case this could work:
find . -name 'docker-compose.yml' -execdir ...
Unquote0270@programming.dev 6 days ago
I hope the real version doesn’t have the spelling problem!