2012-11-17 50 views
0
#!/bin/bash 
# Bash commands go here 

/usr/bin/expect - << EndMark 
This is the expect script 
expect commands go here 
and here 
until: 
EndMark 

# More bash commands go here. 

exit 0 

這樣的事情可以讓我從bash中啓動expect腳本。但是,當它進入More bash命令部分時,它會停止期望進程(以及它產生的進程)是否有可能回到相同的期望腳本中?bash和expect互動

eg - Start expect script 
    - At a certain point leave the expect to bash operations 
    - return to the same expect script? 
+0

您是否希望在執行bash命令時繼續運行expect腳本作爲另一個進程,還是希望它在停止bash節之前停止? – Rubens

+0

我不認爲這是適用的,因爲一旦你從期望中脫身,如果再次調用它,它將從開始 –

+0

我正在做的是更改期望腳本正在使用的目錄中的文件。當腳本啓動時,文件可以在那裏,我不能停止腳本將它們放入其中。 – confusified

回答

0

沒有必要離開預期過程中,爲了發出shell命令 - 你可以從期望腳本中使用system命令。