0
在我的測試文件中,我有這行hello $ LG。所以,如果我做輸入期望腳本
`cat /test`
它會顯示在我的bash shell - 你好$ LG
但是,當我嘗試做這在我的預料腳本,
$> expect test.sh `cat /test`
它給了我這個{你好$ LG}。我不知道它爲什麼會變得{}。任何人都知道如何解決此問題?
在我的測試文件中,我有這行hello $ LG。所以,如果我做輸入期望腳本
`cat /test`
它會顯示在我的bash shell - 你好$ LG
但是,當我嘗試做這在我的預料腳本,
$> expect test.sh `cat /test`
它給了我這個{你好$ LG}。我不知道它爲什麼會變得{}。任何人都知道如何解決此問題?
期望基於TCL,您應該使用方括號來執行代碼。當試圖執行shell命令時,您應該使用exec或open或spawn。
我不知道該test.sh做什麼,但
expect [exec test.sh 'cat /test']
可能只是做的伎倆。
還有更多來自這裏的Tcl運行的其他程序: http://www.tcl.tk/man/tcl/tutorial/Tcl26.html