1

I have a directory with a couple of PHP files in multiple levels. I want to execute the following command for all of these PHP files.

php ../../i18n/add-textdomain.php -i bulk-delete file_name.php

So, I wrote the following find command and piped it to xargs

find . -iname "*.php" -type f -print0| xargs -0 php ../../i18n/add-textdomain.php -i bulk-delete

The php command expects the PHP file to be the last argument. I assumed xargs will append the files listed by find at the end. But this doesn't seem to be happening.

How to tell xargs to add the arguments at the end of the command?

4

1 回答 1

5

xargs默认情况下会将项目附加stdin到命令的末尾。您可以使用-I它来覆盖它,但您似乎还有其他问题。每个命令只需要一个 PHP 文件吗?如果是这样,请使用-n 1.

于 2013-05-06T07:16:12.167 回答