使用命令的输出作为下一个命令的输入 [英] Use the output of a command as input of the next command
本文介绍了使用命令的输出作为下一个命令的输入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
所以我从命令行调用这个PHP脚本:
的/ usr / bin中/ PHP的/var/www/bims/index.php项目/输出
和它的输出是:
文件1文件2文件3
我想这样做的就是这个输出和饲料的RM的命令,但我想我没有这样做是正确的:
的/ usr / bin中/ PHP的/var/www/bims/index.php项目/输出| RM
我的目标是什么删除文件名中的PHP脚本输出。应该是什么这样做的正确方法?
谢谢!
解决方案
的/ usr / bin中/ PHP的/var/www/bims/index.php项目/输出| xargs的RM
So I call this PHP script from the command line:
/usr/bin/php /var/www/bims/index.php "projects/output"
and its output is:
file1 file2 file3
What I would like to do is get this output and feed to the "rm" command but I think im not doing it right:
/usr/bin/php /var/www/bims/index.php "projects/output" | rm
My goal is to delete whatever file names the PHP script outputs. What should be the proper way to do this?
Thanks!
解决方案
/usr/bin/php /var/www/bims/index.php "projects/output" | xargs rm
这篇关于使用命令的输出作为下一个命令的输入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文