
走るとき
find -maxdepth 1 -type d -name 'iptp*' -execdir bash -c "ls {}" \;
iptp*という名前のすべてのディレクトリのリストを取得します
走るとき
find -maxdepth 1 -type d -name 'iptp*' -execdir bash -c "git status {}" \;
私は
fatal: Not a git repository (or any parent up to mount parent )
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
git status
find が開始された親ディレクトリで実行されるようです。
何が間違っているのでしょうか?
答え1
を使用すると-execdir
、コマンドは一致を含むディレクトリで実行されます。つまり名前が「iptp」で始まるディレクトリの親ディレクトリ。
.git
代わりに、パス一致するものiptp*
:
find -maxdepth 2 -type -d -name .git -path "*/iptp*/*" -execdir git status \;