![와일드카드를 사용하여 디렉터리를 찾고 git status를 실행하면 작동하지 않습니다.](https://linux55.com/image/109139/%EC%99%80%EC%9D%BC%EB%93%9C%EC%B9%B4%EB%93%9C%EB%A5%BC%20%EC%82%AC%EC%9A%A9%ED%95%98%EC%97%AC%20%EB%94%94%EB%A0%89%ED%84%B0%EB%A6%AC%EB%A5%BC%20%EC%B0%BE%EA%B3%A0%20git%20status%EB%A5%BC%20%EC%8B%A4%ED%96%89%ED%95%98%EB%A9%B4%20%EC%9E%91%EB%8F%99%ED%95%98%EC%A7%80%20%EC%95%8A%EC%8A%B5%EB%8B%88%EB%8B%A4..png)
내가 달릴 때
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 \;