su_auto.tcl
#!/usr/bin/expect
set timeout 30
spawn su youruesrname
expect "Password:"
send "yourpassword\r"
send "source ~/.zshrc\r"
interact
chmod u+x su_auto.tcl
./su_auto.tcl
http://lingxiankong.github.io/blog/2014/11/25/linux-expect/
su_auto.tcl
#!/usr/bin/expect
set timeout 30
spawn su youruesrname
expect "Password:"
send "yourpassword\r"
send "source ~/.zshrc\r"
interact
chmod u+x su_auto.tcl
./su_auto.tcl
http://lingxiankong.github.io/blog/2014/11/25/linux-expect/