shell重启远程服务器 #connServer.sh 登陆服务器脚本 本地文件 #!/usr/bin/expect expect -c spawn ssh ali@192.168.1.1 expect { \*assword\ {set timeout 30; send \123456\r\;} \yes/no\ {send \yes\r\; exp_continue;} } send \cd /home/ali/demoProject \r\ #根据系统而定 maybe /User/ali send \sh reboot.sh \r\ expect e