施用expect实现shell的交互

使用expect实现shell的交互1.安装expectyum install expect 2.编写脚本demo.exp:spawn/var/www/html/image

使用expect实现shell的交互

1.安装expect

yum install expect

2.编写脚本

demo.exp:

 

3.这样,当shell脚本中出现了要求输入密码的时候,脚本就自动输入了。