Вопрос

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?

Это было полезно?

Решение

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 {}"
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top