Hi all,
Im trying to automate some root type activities.
The code imediately below seems to work fine, when I run the script, I am left with an open root terminal session.
Code:
#!/usr/bin/expect
spawn sudo -i
expect ":"
send "MyPassword\r"
expect "#"
interact
The problem comes when I try to add root functions, like shutting down the computer. I'm not sure if there is a timing issue or what is going on, but, I'm stumped.
Code:
#!/usr/bin/expect
spawn sudo -i
expect ":"
send "MyPassword\r"
expect "#"
puts "Shutting down computer "
send "shutdown -h now\r"
also, if there is an easy way to do this without expect, I'd like to know what it is.