I tried to install R across a cluster of computers and someone told me to check out Expect.
I was following a tutorial about Linux Expect Command to automate the process of ssh into node and install open source R automatically.
I am kind of stuck on the ssh part: (Tutorial goes here)
#!/usr/bin/expect -f
if {[llength $argv] != 3} {
puts "usage: ssh.exp username server password"
exit 1
}
set username [lrange $argv 0 0]
set server [lrange $argv 1 1]
set password [lrange $argv 2 2]
set timeout 60
spawn ssh $username@$server.mycompany.com
match_max 100000
expect "*?assword:*"
send -- "$password\r"
send -- "\r"
expect eof
I can run the code and log into the remote server, however, I type in ls and it just hangs on the remote server side. And I ctrl + c and it log out and goes back to my host server.
Can any one tell me how to continue the process in Expect after you log in.
Update: Due to Ireeder's answer.
You just need to replace expect eof with interact and it will hand over the control to the user.