Newbie help: running command-line utils in Ruby

I have this (It's not mine, I found it somewhere):

(Not sure how to format for viewing here)
lines = %x{ssh-agent}

File.open("c:/workspace/sshagent_barf.bat", "w") do |file|
lines.each do |line|
chunks = line.chomp.split ';'

if chunks[0] =~ /^SSH/
file.puts "SET #{chunks[0]}"
end
end
end

What I would like to do is not save the the lines in a .bat but in a
variable or to the screen, and run ssh-add, and be prompted for my
password.

Any help will be greatly appreciated!

~greg

You can execute Programs in differnt ways.
See
- `` Backticks
- popen
- system.

I do not know ssh-add, so I'm not shure what you want to accomplish.

Regards,

Brian

···

On Thu, 18 Nov 2004 02:43:15 +0900 "greg f." <redghoti@gmail.com> wrote:

I have this (It's not mine, I found it somewhere):

(Not sure how to format for viewing here)
lines = %x{ssh-agent}

File.open("c:/workspace/sshagent_barf.bat", "w") do |file|
lines.each do |line|
chunks = line.chomp.split ';'

if chunks[0] =~ /^SSH/
file.puts "SET #{chunks[0]}"
end
end
end

What I would like to do is not save the the lines in a .bat but in a
variable or to the screen, and run ssh-add, and be prompted for my
password.

Any help will be greatly appreciated!

~greg

--
Brian Schröder
http://www.brian-schroeder.de/