Windows에서 expect interpreter의 C 구현을 사용하여 expect 스크립트를 실행하려고하면 "can't set "::exp::winnt_debug": parent namespace doesn't exist
"오류가 발생합니다 (expect543.dll
). 내가 ActiveState의 명령을 통해 tclsh를 실행하면 동일한 스크립트가 잘 작동하지만 ...exp :: winnt_debug 상위 네임 스페이스 오류
스크립트의 문 "set ::exp::winnt_debug 1
는"오류의 원인이다. 이유는 무엇이며 어떻게 해결할 수 있을지 생각해보십시오.
찾아주세요 아래 코드
package require Expect
set ::exp::winnt_debug 1
set prompt "R4#"
set more " --More--"
expect -timeout 10 "$prompt"
set output [open result.txt "w"]
set running 1
spawn plink -telnet "144.21.12.45" -P 2004
send "enable\r"
send "\r"
send "show running-config\r"
send "\r"
while { $running > 0 } {
expect {
"\n" { puts -nonewline $output "$expect_out(buffer)" }
"$more" {send " "}
"lines *-* " { send " " }
#"$prompt" { set running 0 }
eof { set running 0 }
timeout { set running 0 }
}
}
puts "output is .."
Expect 코드를 어떻게 활성화하나요? '패키지 필요'? '로드'? –
"package require expect"명령을 사용하여 활성화했습니다. 참조 용 코드를 추가했습니다. –