![Cita un comando para `find -execdir test [comando]` (Bash)](https://rvso.com/image/1482231/Cita%20un%20comando%20para%20%60find%20-execdir%20test%20%5Bcomando%5D%60%20(Bash).png)
Me gustaría ejecutar el siguiente comando git fetch
en repositorios de git si tiene un control remoto (= git remote
no está vacío):
find -name .git -execdir test $(git remote) \; -execdir git fetch
^^^^^^^^^^^^^
How to quote/escape/mask this?
Probé muchas variaciones que no funcionan como: "$(git remote)"
, '$(git remote)'
, \$\(git remote\)
, '"$(git remote)'"
, ...
Respuesta1
Prueba esto:
find -name .git -execdir sh -c 'test $(git remote)' \; -execdir git fetch \;
y como eso inicia un shell de todos modos, incluso puedes hacer:
find -name .git -execdir sh -c 'test $(git remote) && git fetch' \;