![Cite um comando para `find -execdir test [command]` (Bash)](https://rvso.com/image/1482231/Cite%20um%20comando%20para%20%60find%20-execdir%20test%20%5Bcommand%5D%60%20(Bash).png)
Eu gostaria de executar o seguinte comando git fetch
nos repositórios git se houver um controle remoto (= git remote
não está vazio):
find -name .git -execdir test $(git remote) \; -execdir git fetch
^^^^^^^^^^^^^
How to quote/escape/mask this?
Tentei muitas variações que não funcionam como: "$(git remote)"
, '$(git remote)'
, \$\(git remote\)
, '"$(git remote)'"
, ...
Responder1
Experimente isto:
find -name .git -execdir sh -c 'test $(git remote)' \; -execdir git fetch \;
e como isso inicia um shell de qualquer maneira, você pode até fazer:
find -name .git -execdir sh -c 'test $(git remote) && git fetch' \;