Frage

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?

War es hilfreich?

Lösung

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 {}"
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top