2012-07-18 39 views
0

我正在腳本上自動安裝phoronix測試套件。實際安裝過程很順利,但該程序需要php。它將在RHEL或SUSE上運行,這意味着我必須爲每一個(一個用於yum,另一個用於zypper)。我的問題與使用 - 我無法讓它正確地與各自的安裝程序進行交互。有沒有人有我的錯誤,語法或其他?做什麼指針?非常感激。期望語法問題

備註 - 如果有一種方法可以與做到這一點,那聽起來會很神奇。

spawn ./wgetphoronix.py 
expect {"Phoronix install finished. RHEL OS." {spawn yum install php \ 
             expect "Nothing to do." {break}\ 
               "Is this ok \\\[y/N\\\]: " {interact}}\ 
             {spawn yum install php-dom \ 
             expect "Nothing to do." {break}\ 
               "Is this ok \\\[y/N\\\]: " {interact}}} 
     "Phoronix install finished. RHEL OS." {spawn zypper install php \ 
             expect "Nothing to do." {break}\ 
               "Is this ok \\\[y/N\\\]: " {interact}}\ 
             {spawn zypper install php-dom \ 
             expect "Nothing to do." {break}\ 
               "Is this ok \\\[y/N\\\]: " {interact}}} 

回答

1

PExpect is pretty nice,你應該檢查一下。

另外,如果您需要預期做到這一點,請查看autoexpect。

+0

我確實需要這樣做;它適用於我不能假設的服務器。可悲的是,在涉及百勝時,autoexpect似乎沒有功能。你有其他建議嗎? – user1536030 2012-07-19 19:27:19

+0

@ user1536030 PExpect,然後。 – 2012-07-19 20:27:18