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
Run Code Online (Sandbox Code Playgroud)
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
Run Code Online (Sandbox Code Playgroud)
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.
如何告诉xargs在命令末尾添加参数?
xargsstdin默认情况下,确实将项目附加到命令的末尾。您可以使用-I来覆盖它,但似乎其他地方对您来说出了问题。每个命令是否只需要一个 PHP 文件?如果是这样,请使用-n 1.