我需要一些幫助。我在執行OSX的bash中的expect命令時出現問題
OS:MAC OSX 10.9.4
我運行bash腳本如下: SH create-emulator.sh AVD_16 14在/ usr /本地/ KS-測試自動化/ AVD -lib/86 QVGA
的代碼:
create_emulator() {
android create avd -n $Emulator -t $Target -p $Location --abi $Processor --skin $Skin --force
expect "Android 4.4.2 is a basic Android platform."
expect "Do you wish to create a custom hardware profile [no]"
send "no\n"
}
main_method() {
create_emulator
}
Emulator="$1"
Target="$2"
Location="$3"
Processor="$4"
Skin="$5"
main_method
輸出退出後使用Ctrl + C腳本:
Couldn't read file "Android 4.4.2 is a basic Android platform.": no such file or directory
couldn't read file "Do you wish to create a custom hardware profile [no]": no such file or directory
/usr/local/ks-test-automation/shell-script-lib/create-emulator.sh: line 14: send: command not found
在此先感謝
我敢肯定你期望的語法是錯誤的。檢查['期待'手冊頁](https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/expect.1.html) – 2014-09-22 13:55:35
我不認爲'期望'會做什麼你認爲它的確如此。 – njzk2 2014-09-22 13:55:50
@ njzk2我認爲'期待'的目的正是OP之後的目標,但他沒有正確使用它。 – 2014-09-22 13:58:21