0
我有一個程序要求輸入。例如:如何自動化運行提示用戶輸入的命令?
$ program arg1 arg2
Enter the value of arg3: foo
Enter the value of arg4: spam
$
如何自動運行?我懷疑expect
提供的功能,但以下我不工作:
#!/usr/bin/expect
set timeout 20
spawn "./program arg1 arg2"
expect "Enter the value of arg3:" { send "foo\r" }
expect "Enter the value of arg4:" { send "spam\r" }
interact
沒有人有想法?謝謝。
正確的,我忘了慶典在這裏文檔。謝謝。 – RNA 2013-04-11 07:08:13