远程控制主机脚本
expect 脚本, 命名格式,expect.* expect开头
#!/usr/bin/expect # # set USER root set ADDR 10.0.0.77 set PASSWD lyjatech spawn ssh $USER@$ADDR expect { "yes/no" { send "yes\n";exp_continue } "password" { send "$PASSWD\n" } } interact
expect 脚本, 命名格式,expect.* expect开头
#!/usr/bin/expect # # set USER root set ADDR 10.0.0.77 set PASSWD lyjatech spawn ssh $USER@$ADDR expect { "yes/no" { send "yes\n";exp_continue } "password" { send "$PASSWD\n" } } interact