限制命令在规定时间内执行 timeout 程序
function check(){
expect -c "
spawn ssh -A -q -\oStrictHostKeyChecking=no user@IP -t \" sudo timeout 2s sh test.sh \"
expect {
\"*assword\" { send \"pass\r\"; exp_continue;
expect {
\"*assword*\" { send \"pass\r\"; exp_continue;
} }
}}
expect eof"
}
check