脚本登录远端服务器并执行命令


#!/bin/sh

set timeout 30
spawn ssh <username>@<server_ip>
expect {
"*yes/no*" { send "yes\r"; exp_continue}
"*Password:*" {send "password\r"}
}
expect "*#*"
send "pss\r"
interact

猜你喜欢

转载自xiaocao000.iteye.com/blog/2090323
今日推荐