简体   繁体   English

PERL:如何在包装器内重定向脚本的STDOUT

[英]PERL: How to redirect STDOUT of a script inside a wrapper

I want to make a perl script which gonna be a wrapper to another script. 我想制作一个Perl脚本,该脚本将成为另一个脚本的包装。 Inside my wrapper, I run the "other script" with some parameters. 在包装器中,我使用一些参数运行“其他脚本”。 This "other script" should print quite a lot of runtime data to the STDOUT. 此“其他脚本”应将大量运行时数据打印到STDOUT。 So, how do I let the "some script" print the data to STDOUT immediately when I run it inside my perl wrapper? 因此,当我在perl包装器中运行数据时,如何让“某些脚本”立即将数据打印到STDOUT? (I don't want any files/variables only the STDOUT) (我不希望任何文件/变量只有STDOUT)

Thank you for your answers in advance! 预先感谢您的答复!

If you call your command with system() then the stdout will go to stdout. 如果您使用system()调用命令,则标准输出将转到标准输出。

eg: 例如:

perl -e "system('ls');"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM