Package: expect
Version: 5.16.3
Revision: 3

The following dumps core when put into a file and executed.

I realize I should probably spawn su inside a shell, but I don't think
expect should core dump even so.

#!/usr/bin/expect -f

# Give my roommate a way to safely turn off my machine without giving
# him the root password.

set password [exec cat /root/.password]
spawn su
expect Password:
send $password\r
expect #
send_user "Shut down completely? Are you sure? "
expect_user -re -nocase "y(es)?" {send_user "Closing down!"} -re -nocase "no?" 
{send_user "Not closing down"}


Reply via email to