时间:2021-05-11 08:55:20 | 栏目:Linux | 点击:次
#!/usr/bin/expect set timeout 20 set password "12345678" spawn /usr/bin/sudo su expect "*password for xxx: " send "$password\n" interact
保存内容到一个文件中,如exp-demo.sh
chmod 0777 exp-demo.sh
然后在shell下执行: expect exp-demo.sh