1

When I run

find -maxdepth 1 -type d -name 'iptp*' -execdir bash -c "ls {}" \;

I get a listing of all dirs named iptp*

When I run

find -maxdepth 1 -type d -name 'iptp*' -execdir bash -c "git status {}" \;

I get

fatal: Not a git repository (or any parent up to mount parent )
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

I seems like git status is run in the parent dir where find was started.

What do I make wrong?

1

1 Answer 1

3

With -execdir, the command is run in the directory containing the match, i.e. the parent directory of the directory whose name starts with “iptp”.

You could instead look for .git with a path matching iptp*:

find -maxdepth 2 -type -d -name .git -path "*/iptp*/*" -execdir git status \;

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .