
내가 달릴 때
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
찾기가 시작된 상위 디렉토리에서 실행되는 것 같습니다 .
내가 뭘 잘못한 걸까요?
답변1
를 사용하면 -execdir
일치 항목이 포함된 디렉터리에서 명령이 실행됩니다.즉이름이 "iptp"로 시작하는 디렉터리의 상위 디렉터리입니다.
.git
대신 다음을 사용하여 찾을 수 있습니다.길매칭 iptp*
:
find -maxdepth 2 -type -d -name .git -path "*/iptp*/*" -execdir git status \;