| Paste number 6912: | Ruby version |
| Pasted by: | Leimy |
| When: | 8 years, 1 month ago |
| Share: | Tweet this! | http://paste.lisp.org/+5C0 |
| Channel: | #opendarwin |
| Paste contents: |
#!/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.