telnet 交互
#!/bin/bash Ip="10.0.1.53" a="\{\‘method\‘\:\‘doLogin\‘\,\‘params\‘\:\{\‘uName\‘\:\‘bobbietest\‘\}" /usr/bin/expect -c" set timeout 15 spawn telnet ${Ip} 8000 expect "Escape" send "${a}\\r" expect { -re "\"err.*none\"" { exit 0 } timeout { exit 1 } eof { exit 2 } } " echo $?