再来一个expect脚本
[root@jenkins scripts]# cat expect_test1205.sh #!/usr/bin/expect ############################################################## # File Name: expect_test1205.sh # Version: V1.0 # Author: gaobo # Organization: 641627690@qq.com # Created Time : 2017-12-05 22:40:08 # Description: ############################################################## spawn ssh root@10.0.0.51 uptime expect "*yes/no*" send "yes\r" expect "*password*" send "123456\r" expect eof
关键是执行:expect expect_test1205.sh
执行用expect命令.直接sh可能执行不成功
时来天地皆同力,运去英雄不自由