在编写次脚本之前先安装expect
#sudo   apt-get install expect
 
以下是角本内容:
#!/usr/bin/expect -f
set timeout 30
spawn ssh -v -1 -c des 
pix@10.63.128.80
expect "password:"
send "cisco\r"
send "cd /var/bin\r"
send "./apachectl stop\r"
send "sleep 1\r"
send "./apachectl start\r"
interact