Paste number 6912: Ruby version

Paste number 6912: Ruby version
Pasted by: Leimy
When:9 years, 3 weeks ago
Share:Tweet this! | http://paste.lisp.org/+5C0
Channel:#opendarwin
Paste contents:
Raw Source | XML | Display As
#!/usr/bin/ruby
class SSHAgent
  def initialize
	@agent_env = Hash.new
	agenthandle = IO.popen("/usr/bin/ssh-agent -s", "r")
	agenthandle.each_line do |line|
	  if line.index("echo") == nil
		  line = line.slice(0..(line.index(';')-1))
		  key, value = line.chomp.split(/=/)
		  puts "Key = #{key}, Value = #{value}"
		  @agent_env[key] = value
	  end
	end
  end
  def [](key)
	return @agent_env[key]
  end
end

agent = SSHAgent.new
puts ENV["SSH_AUTH_SOCK"]
puts agent["SSH_AUTH_SOCK"]

exec("/bin/ln", "-sf", agent["SSH_AUTH_SOCK"], ENV["SSH_AUTH_SOCK"])

This paste has no annotations.

Colorize as:
Show Line Numbers

Lisppaste pastes can be made by anyone at any time. Imagine a fearsomely comprehensive disclaimer of liability. Now fear, comprehensively.