标签:expect
#!/usr/bin/expect
set timeout 5
spawn ssh root@192.168.3.8 "df -Th >>/root/disk.txt"
expect {
"*yes/no" { send "yes\r"; exp_continue}
"*password:" { send "vision\r" }
}
spawn scp 192.168.3.8:/root/disk.txt /root/
expect "*password*"
send "vision\r"
expect eof
本文出自 “小V运维之路” 博客,请务必保留此出处http://victor2016.blog.51cto.com/6768693/1915058
标签:expect
原文地址:http://victor2016.blog.51cto.com/6768693/1915058