#!/bin/bash
ip="172.16.1.113"
command="ssh $ip"
expect -c "
spawn $command;
expect {
\"Are you sure you want to continue connecting (yes/no)?\" {send \"yes\r\"; exp_continue}
}
"
原文地址:http://wemux.blog.51cto.com/2848943/1543960