R
Rich Masci
I have a expect scripts that I use to get from system to system, and
would like to translate them into Ruby. These scripts I use to ssh into
a system, setup environment variables and aliases that then turn over
control to me.. My scripts are usually a lot longer bug basically in
Expect:
set host [lindex $argv 0]
set password "myp@$$"
set prompt "
spawn ssh $host
expect -re "\[P|p]asssword
send "$password\r"
expect $prompt
send "<custom environment variables and aliases>\r"
interact
Invoking a script like this with a hostname or ip address will log me
into that system, and customize it for my liking without making changes
to the server it's self. Expect also allows you to log your session
(not shown in above example) so two months later you can pull your log
file and see how you ran a given command.
Is there any Ruby extension that gives me the same functionality? The
book 'Exploring Expect' has a chapter on using the expect library with
Ruby or other C programs, has anyone attempted to use his library with
Ruby? I also see that ruby tk has a way of wrapping tcl commands, and in
irb I've actually loaded the Expect extension for TCL, but I've no idea
how to use it.
would like to translate them into Ruby. These scripts I use to ssh into
a system, setup environment variables and aliases that then turn over
control to me.. My scripts are usually a lot longer bug basically in
Expect:
set host [lindex $argv 0]
set password "myp@$$"
set prompt "
spawn ssh $host
expect -re "\[P|p]asssword
send "$password\r"
expect $prompt
send "<custom environment variables and aliases>\r"
interact
Invoking a script like this with a hostname or ip address will log me
into that system, and customize it for my liking without making changes
to the server it's self. Expect also allows you to log your session
(not shown in above example) so two months later you can pull your log
file and see how you ran a given command.
Is there any Ruby extension that gives me the same functionality? The
book 'Exploring Expect' has a chapter on using the expect library with
Ruby or other C programs, has anyone attempted to use his library with
Ruby? I also see that ruby tk has a way of wrapping tcl commands, and in
irb I've actually loaded the Expect extension for TCL, but I've no idea
how to use it.