我寫了一個bash腳本,期望在內部連接到終端服務器並清除行。 我無法弄清楚我得到的錯誤,因爲我已經給出了所有必要的大括號。我也不理解couldn't read file "line": no such file or directory
錯誤。 請幫忙。bash腳本中的期望幫助
我的腳本:
#!/bin/bash
VAR=$(expect -c "
spawn telnet 1.1.1.1
expect {
"Password:" { send "password\r" ; exp_continue}
"Prompt>" { send "en\r" ; exp_continue}
"Password:" { send "password\r" ; exp_continue}
"Prompt#" {send "clea line 10\r" ; exp_continue}
"[confirm]" {send "Y\r" ; exp_continue}
"Prompt#" {send "clea line 11\r" ; exp_continue}
"[confirm]" {send "Y\r" ; exp_continue}
"Prompt#" {send "exit\r" }
}
")
echo $VAR
其輸出:
missing close-brace
while executing
"expect"
couldn't read file "line": no such file or directory
感謝您的詳細解釋。這真的幫助我解決我的問題,我做了兩個更多的更改,我將在單獨回答相同的帖子時詳細說明。 – Pkp 2011-04-07 18:45:53