改变用户密码的脚本

#!/usr/bin/expect -f
set user [lindex $argv 0]
set newpwd [lindex $argv 1]
set timeout 10
spawn passwd $user
expect "*password:" {send "$newpwd
"}
expect "*password:" {send "$newpwd
"}
expect eof
exit
原文地址:https://www.cnblogs.com/cphmvp/p/5942178.html