예상 스크립트로 Linkproof 장치를 백업하려고하는데 문제가 있습니다. 수명령이 Expect와 함께 버퍼에 쓰지 않습니다.
호스트의 진위를 '@IP (XXX.XXX.XXX.XXX)')
#!/usr/bin/expect
spawn ssh @IPADDRESS
expect "username:"
# Send the username, and then wait for a password prompt.
send "@username\r"
expect "password:"
# Send the password, and then wait for a shell prompt.
send "@password\r"
expect "#"
# Send the prebuilt command, and then wait for another shell prompt.
send "system config immediate\r"
#Send space to pass the pause
expect -re "^ *--More--\[^\n\r]*"
send ""
expect -re "^ *--More--\[^\n\r]*"
send ""
expect -re "^ *--More--\[^\n\r]*"
send ""
# Capture the results of the command into a variable. This can be displayed, or written to disk.
sleep 10
expect -re .*
set results $expect_out(buffer)
# Copy buffer in a file
set config [open linkproof.txt w]
puts $config $results
close $config
# Exit the session.
expect "#"
send "logout\r"
expect eof
출력 파일의 내용, 기대 난 내 한계에 도달이에 그것은 내 첫 번째 스크립트입니다 설립 될 수 없다.
RSA 키 지문은 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX입니다.
정말 연결 하시겠습니까 (예/아니요)?
가 '예'또는 '아니오'를 입력하십시오 @username : @Password
'예'또는 '아니오'를 입력하십시오 : 즉시 시스템 설정
입력하세요 '예'또는 '아니오'
사용자가 볼 수있는 것처럼 명령 결과는 파일에 없습니다. 왜 제발 저를 도와 주시겠습니까? 도움 주셔서 감사합니다. 그들이 기다리고있는 텍스트가 실제로 표시되는 텍스트를 일치하지 않기 때문에
로무는