如何使我的脚本等到上一个命令完成?

时间:2014-03-06 11:42:21

标签: multithreading perl installer

我有以下Perl脚本代码来安装oracle DB应用程序。

system("./runInstaller -silent -responsefile filename.rsp");
if($?==0)
{
   //perform some operation type1;
}
else
{
   //perform some operation type2;
}

在此代码中,应在完整安装应用程序后执行if块的执行。但该脚本与安装程序并行运行。

我已经使用了`` exec 而不是系统,但没有一个能够正常工作。

帮我解决这个问题。

提前致谢。

1 个答案:

答案 0 :(得分:2)

使用runInstaller的-waitforcompletion选项使脚本等待它完成执行。所以现在:

system("./runInstaller -silent -responseFile filename.rsp");

将成为

system./runInstaller -silent -waitforcompletion -responseFile filename.rsp");

有关runInstaller Click here

的更多信息