Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在运行这段 perl 脚本:
system "bash", "-c", " some command; exit \${PIPESTATUS[0]}" and die "has failed"
现在,如果some command没有正确执行,脚本将失败,has failed没有更多有用的信息。
some command
has failed
如何使die命令打印some command产生的任何错误消息?
die
谢谢
像这样的东西:
system($cmd) == 0 or die "$0: [$cmd] failed: $?\n";
另请参阅Perl 错误变量。