Pergunta

For example, if I have a command:

find . -name "*.png" |xargs -I{} sh -c "mycommand {}"

If I have a.png and b.png in the current folder, I want a way to show the following, but not execute them:

mycommand a.png
mycommand b.png

Is there anyway to achieve this?

Foi útil?

Solução

You could change that command to

find . -name "*.png" |xargs -I{} echo "mycommand {}"

If you just want to show the command before execute it, you could use -t option of xargs:

find . -name "*.png" |xargs -t -I{} sh -c "mycommand {}"
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top