我写了一个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