如下:
#!/usr/bin/expect -f spawn su root expect "Password:" send "mypasswd\r" interact
shell脚本 切换用户
原文:https://www.cnblogs.com/pinganzi/p/9277704.html